Commit 234b76a9 authored by Jonne Haß's avatar Jonne Haß

properly integrate asset_sync

parent e05c6e88
......@@ -20,7 +20,7 @@ module LayoutHelper
end
def set_asset_host
path = ENV['ASSET_HOST'].to_s + '/assets/'
path = AppConfig.environment.assets.host.to_s + '/assets/'
content_tag(:script) do
<<-JS.html_safe
if(window.app) app.baseImageUrl("#{path}")
......
......@@ -24,7 +24,6 @@ if defined?(Bundler)
# Bundler.require(:default, :assets, Rails.env)
end
module Diaspora
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
......@@ -73,7 +72,6 @@ module Diaspora
# Enable the asset pipeline
config.assets.enabled = true
# Do not load whole env on precompile
config.assets.initialize_on_precompile = false
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
......
......@@ -19,4 +19,4 @@ rescue Bundler::GemNotFound => e
STDERR.puts e.message
STDERR.puts "Try running `bundle install`."
exit!
end if File.exist?(gemfile)
\ No newline at end of file
end if File.exist?(gemfile)
......@@ -11,7 +11,6 @@ defaults:
url: "http://localhost:3000/"
certificate_authorities:
redis:
serve_static_assets: false
require_ssl: true
single_process_mode: false
s3:
......@@ -21,6 +20,10 @@ defaults:
bucket:
region:
image_redirect_url:
assets:
serve: false
upload: false
host:
pubsub_server: 'https://pubsubhubbub.appspot.com/'
unicorn:
embed_resque_worker: false
......@@ -87,7 +90,8 @@ defaults:
development:
environment:
serve_static_assets: true
assets:
serve: true
single_process_mode: true
require_ssl: false
settings:
......@@ -99,7 +103,8 @@ test:
url: "http://localhost:9887/"
single_process_mode: true
require_ssl: false
serve_static_assets: true
assets:
serve: true
settings:
follow_diasporahq: false
invitations:
......@@ -114,10 +119,12 @@ test:
integration1:
environment:
url: "http://localhost:45789/"
serve_static_assets: true
assets:
serve: true
require_ssl: false
integration2:
environment:
url: "http://localhost:34658/"
serve_static_assets: true
assets:
serve: true
require_ssl: false
......@@ -16,7 +16,7 @@ require File.expand_path('../application', __FILE__)
require Rails.root.join("lib", "exceptions")
# Load configuration system early
require Rails.root.join("config", "load_config")
require Rails.root.join('config', 'load_config')
Haml::Template.options[:format] = :html5
Haml::Template.options[:escape_html] = true
......
......@@ -37,12 +37,6 @@ Diaspora::Application.configure do
# In production, Apache or nginx will already do this
config.serve_static_assets = false
# Enable serving of images, stylesheets, and javascripts from an asset server
if ENV['ASSET_HOST']
config.action_controller.asset_host = ENV['ASSET_HOST']
end
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
......@@ -55,6 +49,10 @@ Diaspora::Application.configure do
# Generate digests for assets URLs
config.assets.digest = true
if defined?(AppConfig) && AppConfig.environment.assets.host.present?
config.action_controller.asset_host = AppConfig.environment.assets.host.get
end
config.threadsafe!
end
......
if AppConfig.environment.assets.upload? && AppConfig.environment.s3.enable?
require 'asset_sync'
AssetSync.configure do |config|
config.enabled = true
config.fog_provider = 'AWS'
config.aws_access_key_id = AppConfig.environment.s3.key.get
config.aws_secret_access_key = AppConfig.environment.s3.secret.get
config.fog_directory = AppConfig.environment.s3.bucket.get
# Increase upload performance by configuring your region
config.fog_region = AppConfig.environment.s3.region.get
#
# Don't delete files from the store
# config.existing_remote_files = "keep"
#
# Automatically replace files with their equivalent gzip compressed version
# config.gzip_compression = true
#
# Use the Rails generated 'manifest.yml' file to produce the list of files to
# upload instead of searching the assets directory.
# config.manifest = true
#
# Fail silently. Useful for environments such as Heroku
# config.fail_silently = true
end
end
......@@ -3,6 +3,6 @@
# the COPYRIGHT file.
Diaspora::Application.configure do
config.serve_static_assets = AppConfig.environment.serve_static_assets?
config.serve_static_assets = AppConfig.environment.assets.serve?
# config.static_cache_control = "public, max-age=3600" if AppConfig[:serve_static_assets].to_s == 'true'
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment