O'Reilly logo

RSpec Essentials by Mani Tadayon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

File-based configuration management

What we're going to do is to put all of our configurations into a file and load them from the file when we start our app. This is quite simple to get started with, but we'll have to evolve in order to support some important basic needs. We'll start with a config file, which we'll name .env, which is a commonly used convention, although the name is actually not important. Here are the contents of the file:

TODO_STORE='redis'
REDIS_URL='redis://127.0.0.1:6379/0'
REDIS_PASSWORD='cantguessthis'

The format is that of variable declarations in a Bash shell script. This is appropriate because using environment variables will force us to use Bash variables in the end. We avoid the confusion of type conversions by declaring ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required