Features
New loaders
- Doppler support.
Just specify your Doppler service token in the DOPPLER_TOKEN
env var, and Anyway would automatically download configuration from Doppler.
- ESJON support.
If you use EJSON to store encrypted secrets, Anyway would try to load configuration from config/secrets.ejson
(and environment-specific .ejson
files, too).
API enhancements
- You can now mark nested attributes as required:
class AppConfig < Anyway::Config
attr_config :assets_host, database: {host: nil, port: nil}
required :assets_host, database: [:host, :port]
end
-
Predicate methods are automatically defined for attributes with the
:boolean
type. -
Added ability to use
env_prefix ""
to load data rom unprefixed env vars. -
Added
Config#as_env
to convert config values into a ENV-like Hash.
This can be useful to export configuration to be used with legacy tools relying on ENV. So, for example, you can load data from credentials, secrets, whatever and make it available via ENV.
Experimental features
- Sub-configs support via types.
class AnotherConfig < Anyway::Config
attr_config foo: "bar"
end
class MyConfig < Anyway::Config
attr_config :another_config
coerce_types another_config: "AnotherConfig"
end
MyConfig.new.another_config.foo #=> "bar"
ENV["MY_ANOTHER_CONFIG__FOO"] = "baz"
MyConfig.new.another_config.foo #=> "baz"