Hiding keys and secrets in Ruby on Rails

The dotenv Gem

gem 'dotenv-rails'
touch .env
/.env

Using the dotenv Gem

EXTERNAL_API_KEY=12345678910ABCDEFG
JWT_SECRET=KEEPITSECRETKEEPITSAFE
ENV["EXTERNAL_API_KEY"]
ENV["JWT_SECRET"]

Note regarding Heroku

Current Web Development student at https://flatironschool.com/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store