Skip to content

Instantly share code, notes, and snippets.

@slumos
Last active December 10, 2015 21:48
Show Gist options
  • Select an option

  • Save slumos/4497379 to your computer and use it in GitHub Desktop.

Select an option

Save slumos/4497379 to your computer and use it in GitHub Desktop.
module MyApp
class Application < Rails::Application
# Allows us to read configuration from unconventional places
# (e.g. /etc).
#
# To use:
# config/config_paths.yml:
# development:
# config/blah: config/blah.yml
#
# config/initializers/blah.rb:
# BLAH_CONFIG = YAML.load_file(Rails.application.paths['config/blah'].first)
#
def paths
return @paths if @paths
@paths = super
config_paths = YAML.load_file("#{config.root}/config/config_paths.yml") rescue {}
if config_paths[Rails.env] then
config_paths[Rails.env].each do |key, path|
@paths.add key, :with => path
end
end
return @paths
end
end
end
development:
config/blah: config/blah.yml
production:
config/blah: /etc/myapp/blah.yml
config/database: /etc/myapp/database.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment