diff --git a/config/app_config.yml b/config/app_config.yml deleted file mode 100644 index bd306725ed61e66dcc613616a843a70e15f09646..0000000000000000000000000000000000000000 --- a/config/app_config.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -default: - socket_host: 0.0.0.0 - socket_debug: false - pod_url: tom.joindiaspora.com - mongo_post: 27017 - socket_collection_name: websocket - socket_port: 8080 - pubsub_server: https://pubsubhubbub.appspot.com/ - mongo_host: localhost - debug: false -production: -development: - pod_url: tom.joindiaspora.com -test: - pod_url: http://example.org/ - socket_port: 8081 diff --git a/config/initializers/_load_app_config.rb b/config/initializers/_load_app_config.rb index ac14c97d84e8676020eab4c41cbea5c4be26c0cf..33f7b183be8cf732c9a37e5780484f12feedc73a 100644 --- a/config/initializers/_load_app_config.rb +++ b/config/initializers/_load_app_config.rb @@ -2,10 +2,20 @@ # licensed under the Affero General Public License version 3. See # the COPYRIGHT file. -raw_config = File.read("#{Rails.root}/config/app_config.yml") -all_envs = YAML.load(raw_config) -if all_envs[Rails.env] - APP_CONFIG = all_envs['default'].merge(all_envs[Rails.env]).symbolize_keys +def load_config_yaml filename + YAML.load(File.read(filename)) +end + +if File.exist? "#{Rails.root}/config/app_config.yml" + all_envs = load_config_yaml "#{Rails.root}/config/app_config.yml" + all_envs = load_config_yaml "#{Rails.root}/config/app_config_example.yml" unless all_envs +else + puts "WARNING: No config/app_config.yml found! Look at config/app_config_example.yml for help." + all_envs = load_config_yaml "#{Rails.root}/config/app_config_example.yml" +end + +if all_envs[Rails.env.to_s] + APP_CONFIG = all_envs['default'].merge(all_envs[Rails.env.to_s]).symbolize_keys else APP_CONFIG = all_envs['default'].symbolize_keys end diff --git a/db/seeds/backer.rb b/db/seeds/backer.rb index 1730ee202faa7bb57c439bf29a173dc05cfec0b1..8fa72f23dc941ea7a197ece0667be833595cccf5 100644 --- a/db/seeds/backer.rb +++ b/db/seeds/backer.rb @@ -46,7 +46,7 @@ def set_app_config username current_config[Rails.env.to_s] ||= {} current_config[Rails.env.to_s]['pod_url'] = "#{username}.joindiaspora.com" current_config['default']['pod_url'] = "#{username}.joindiaspora.com" - file = File.new(Rails.root.join('..','shared','app_config.yml'),'w') + file = File.new(Rails.root.join('..','..','shared','app_config.yml'),'w') file.write(current_config.to_yaml) file.close end diff --git a/db/seeds/tom.rb b/db/seeds/tom.rb index d8152a33bf79d58a3abe9212d0098526434495eb..50d41eb91994eb2ae6c46dd3cb04edadd25bacdb 100644 --- a/db/seeds/tom.rb +++ b/db/seeds/tom.rb @@ -11,7 +11,7 @@ def set_app_config username current_config[Rails.env.to_s] ||= {} current_config[Rails.env.to_s]['pod_url'] = "#{username}.joindiaspora.com" current_config['default']['pod_url'] = "#{username}.joindiaspora.com" - file = File.new(Rails.root.join('..','shared','app_config.yml'),'w') + file = File.new(Rails.root.join('..','..','shared','app_config.yml'),'w') file.write(current_config.to_yaml) file.close end