DEV Community

Discussion on: Easier usage of Rails 5.2 credentials and app-specific configuration

Collapse
 
colinrubbert profile image
Colin Rubbert

You can also do something like this (if you had an environment variable set to SMTP_USERNAME):

user_name: Rails.application.credentials.SMTP_USERNAME
password:  Rails.application.credentials.SMTP_PASSWORD

You can use the line Rails.application.credentials.[YOUR ENV VARIABLE] to call your env variable you set in the credentials file.

That, to me, seems to be the easiest with the least amount of code needing to be written.