A library for accessing ZConfig-managed configurations within Ruby. It includes a watcher to automatically reload configurations when files are modified by the daemon.
This gem is currently only compatible with UNIX-based systems with inotify-tools installed. Support for more will be coming soon.
The gem needs to know the path to your ZConfig-managed configuration files, and what environment you're running in.
ZConfig.setup do |s|
s.base_path = "/etc/zconfig"
s.environment = :production # default is development
end
If you wish to automatically reload the configuration as soon as it's modified, you'll need to tell ZConfig to watch:
ZConfig.watch!
Retrieving values is easy. The following example assumes you have a servers.yml
with a key called db
.
ZConfig.get(:servers, :db) # returns nil if not found