Adds new routing in routes.rb based on pod_uri. Assets are handled by a symlink in public when using sub-uri. Various clean-up, removing thin and socket port settings from server.sh (these are now taken from pod_uri and socket_port). Basic functionality when setting a sub_uri like http://example.org/diaspora now seems OK. Closes .http://joindiaspora.com/issues/737, and partially http://joindiaspora.com/issues/391. Ports are yet to be defined and handled in this context. Conflicts: app/views/layouts/application.html.haml config/routes.rb
31 lines
1.2 KiB
Ruby
31 lines
1.2 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!
|
|
|
|
# Valid as long as thin serves the assets.
|
|
ActionController::Base.asset_host = APP_CONFIG[ :pod_url]
|