rails set variable for rb file code example
Example 1: rails call env file
#in the .ENV file:
SECRET_TOKEN=qoLsDGcc8YEdeFQ8xWbtiwafMJvjUXpH
#in your code
key = ENV['SECRET_TOKEN']
Example 2: ruby on rails set environment variables example
MAIL_USERNAME: 'Your_Username' MAIL_PASSWORD: 'Your_Username'