Skip to content

Instantly share code, notes, and snippets.

@eric
Created June 26, 2010 00:05
Show Gist options
  • Save eric/453616 to your computer and use it in GitHub Desktop.
Save eric/453616 to your computer and use it in GitHub Desktop.
fact-specific configuration for moonshine.yml
# Provide a :rails_env fact
Facter.add(:rails_env) do
setcode do
ENV["RAILS_ENV"] || 'production'
end
end
# Your application manifest
class ApplicationManifest < Moonshine::Manifest
# Let us use non-symbol keys in the moonshine.yml
def self.configure(hash)
__config__.replace(__config__.deep_symbolize_keys.deep_merge(hash.deep_symbolize_keys))
end
# Perform fact-specific overrides
if configuration[:overrides].respond_to?(:each)
configuration[:overrides].each do |key, overrides|
if override = overrides[Facter.value(key).to_sym] rescue nil
configure(override)
end
end
end
# ...
end
scout:
agent_key: "c16edcd4-12e5-4e08-a58f-6a2b3c9d97ff"
overrides:
fqdn:
srv1.hosting.com:
scout:
agent_key: "9c72ba1e-fa7c-497e-833a-4af85ca239c5"
srv2.hosting.com:
scout:
agent_key: "71a4ee91-15e0-4b16-88a9-4713f61afb03"
rails_env:
staging:
mysql:
innodb_buffer_pool_size: 32M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment