Rails 5.1 introduced the use of secrets
for storing encrypted secrets in source control.
It also allowed
plain environment specific settings storage
making usage of secrets.yml.
And access this configuration using Rails.application.secrets
Rails made use of SECRET_BASE_KEY for these encrypting the stored secrets.
The combination of config/secrets.yml, config/secrets.yml.enc and SECRET_BASE_KEY was confusing.
It was not clear what one should be putting in these secrets, encrypted secrets and how SECRET_BASE_KEY is related to the setup in general.
To overcome this confusion secrets were replaced with credentials,
and limited its usage to only encrypted credentials/
Using secrets is now deprecated.
Using config_for as a replacement for secrets.yml
Since secrets.yml is now deprecated we need a new way to store the configuration above.
We can make use of existing functionality config_for
to achieve the same desired effects.
First, we break down and move the configuration to a new config file.
Since the configuration is about mailer, lets store the config config/mailer.yml
We need to then load this configuration.
After loading this configuration we can start using the mailer configuration on Rails.configuration.mailer
Using config_for helps us break down configuration into separate namespaced files,
relative to what they useful for: mailer, host, exception_notifier and more.