Skip to content

Bump anyway_config from 2.3.1 to 2.4.0

George Koltsov requested to merge dependabot-bundler-anyway_config-2.4.0 into main

Bumps anyway_config from 2.3.1 to 2.4.0.

Release notes

Sourced from anyway_config's releases.

2.4.0

Features

New loaders

Just specify your Doppler service token in the DOPPLER_TOKEN env var, and Anyway would automatically download configuration from Doppler.

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"
</tr></table>

... (truncated)

Changelog

Sourced from anyway_config's changelog.

2.4.0 (2023-04-04)

  • Added Confi#as_env to convert config into a ENV-like Hash. ([@​tagirahmad][])

  • Added experimental support for sub-configs via coercion. ([@​palkan][])

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"
  • Define predicate methods when :boolean type is specified for the attribute. ([@​palkan][])

  • Add support for nested required config attributes. ([@​palkan][])

The API is inspired by Rails permitted params:

class AppConfig < Anyway::Config
  attr_config :assets_host, database: {host: nil, port: nil}
required :assets_host, database: [:host, :port]
end
  • Add support for using env_prefix "" to load from unprefixed env vars. ([@​palkan][])

See #118.

Commits
  • 88c318a Bump 0.4.0
  • e74594f fix: #flatten_hash -> Env.from_hash
  • 19029e8 added #as_env which converts a config instance to the ENV-like hash
  • a8b9d84 feat: experimental subconfigs support
  • 5b3c731 dev: pry-byebug -> debug
  • a8d89ab dev: rubocop-rspec
  • 9e2a183 feat: predicates for explicit boolean attrs
  • e2d073a gemspec: :heart
  • 9387356 forspell: upd dict
  • 801f40c feat: required nested
  • Additional commits viewable in compare view


Dependabot commands
You can trigger Dependabot actions by commenting on this MR
  • @dependabot-bot rebase will rebase this MR
  • @dependabot-bot recreate will recreate this MR rewriting all the manual changes and resolving conflicts

Merge request reports