diaspora/config/environment.rb
Alec Leamas e01fb62eeb Expose and refer to assets on the sub_uri.
When using sub-uri, create a symlink in public/ making the assets
available at the sub-uri. Modify environment.rb so that asset paths
refers to this sub-uri path. Closes http://bugs.joindiaspora.com/issues/391
and http://bugs.joindiaspora.com/issues/737 when application mounted
on suburi (i. e., prev patch)
2011-01-09 23:38:03 +01:00

37 lines
1.4 KiB
Ruby

# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
# Load the rails application
require File.expand_path('../application', __FILE__)
Haml::Template.options[:format] = :html5
Haml::Template.options[:escape_html] = true
if File.exists?(File.expand_path("./config/languages.yml"))
languages = YAML::load(File.open(File.expand_path("./config/languages.yml")))
AVAILABLE_LANGUAGES = (languages['available'].length > 0) ? languages['available'] : { :en => 'English' }
DEFAULT_LANGUAGE = (AVAILABLE_LANGUAGES.include?(languages['default'])) ? languages['default'] : AVAILABLE_LANGUAGES.keys[0].to_s
AVAILABLE_LANGUAGE_CODES = languages['available'].keys.map { |v| v.to_s }
else
AVAILABLE_LANGUAGES = { :en => 'English' }
DEFAULT_LANGUAGES = 'en'
AVAILABLE_LANGUAGE_CODES = ['en']
end
if File.exists?(File.expand_path("./config/langcodes_alias_map.yml"))
LANGUAGE_CODES_MAP = YAML::load(File.open(File.expand_path("./config/langcodes_alias_map.yml")))
else
LANGUAGE_CODES_MAP = {}
end
# Initialize the rails application
Diaspora::Application.initialize!
# Presume the assets are exposed on the sub_uri.
if AppConfig[ :pod_uri].path != "/"
ActionController::Base.asset_host =
Proc.new{ |source, request|
request.scheme + "://" +
request.host_with_port + AppConfig[:pod_uri].path
}
end