Languages

Envlet for Ruby

Envlet.inject fills ENV before Rails or Sinatra boots. One gem, nothing else.

Inject
require "envlet"

Envlet.inject

Stripe.api_key = ENV["STRIPE_KEY"]
Load
require "envlet"

values = Envlet.load

db = PG.connect(values["DATABASE_URL"])
Get
require "envlet"

stripe_key = Envlet.get("STRIPE_KEY")
Install
gem install envlet

Set up

  1. 01

    Install

    gem install envlet or add gem "envlet" to your Gemfile.

  2. 02

    Set one secret

    ENVLET_TOKEN in the process environment.

  3. 03

    Inject at boot

    Require envlet and call Envlet.inject at the top of config/boot.rb or your entrypoint.

Questions

Will my app start if Envlet is down?
No, and that is the point. The SDK retries for a few seconds, then fails so you notice. It never starts your app with half an environment.
What does the host need?
One variable, ENVLET_TOKEN. Everything else arrives at boot.
Can I still set some values on the Ruby host?
Yes. A value the host already set wins. Pass override if you want Envlet to win instead.

Stop pasting .env files.

One command. The right values for whoever runs it.