I am certain that I should not publish my email password to the public git repository in the environment.rb file. Is there a way to avoid this without including the entire file in the .gitignore?
You could save your email credentials within another file config/email.credentials.yml:
host: ...
username: ...
password: ...
...
and within your environment.rb file just load them with (for example):
YAML.load_file("#{Rails.root}/config/email.credentials.yml")['username']
then you would mention the credentials file within the .gitignore file.
Additionally, if you deploy the app on several servers, you might check that the file exists within an initializer and otherwise raise an error. So you make sure the app doesn't start unless the mail config file is present.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With