envless-env is the Envless runtime for Ruby. It fetches your environment when your app starts, decrypts it in the process, fills ENV with every name that is safe to set, and gives your code Envless.env, which reads each variable coerced to the type you set in Envless. No .env files on disk, no dotenv, no ENV["X"] typo that only fails in production.
bundle add envless-envgem install envless-envrequire "envless/env/load"
database_url = Envless.env[:DATABASE_URL]
port = Envless.env[:PORT]It is the Ruby twin of @goenvless/env: the same loader, the same on-disk cache, the same rules for the process environment and the same error messages. A parity check in the Envless repository runs every behaviour of both packages against one fake API before each release, from pagination and the cache to which names are refused from ENV.
What this is, and what it is not
envless-env | envless-sdk | envless run | |
|---|---|---|---|
| Purpose | Loads variables into your running app | Administers a workspace from Ruby | Injects variables into any process |
| Runs | Inside your Ruby process, at boot | In scripts, back offices and CI | In front of your process, as the launcher |
| Credential | A machine key and a decryption key | An API key | envless login, or a machine key |
| Shape | Envless.env[:DATABASE_URL] | Envless.variables.create(...) | envless run -- bin/rails server |
Use envless-env when your app should fetch its own variables at boot, typically in production with a machine key. Use envless run when you would rather keep every credential in the launcher, and the Ruby SDK when you want to create projects or write variables from code. The two runtimes combine: inside envless run, envless-env reads the values the CLI injected and makes no request at all.
The surfaces
| Require | What it gives you |
|---|---|
envless/env | Envless::Env.load, Envless.env and its optional and client views, Envless::Env.override, the explicit loader, the errors and the crypto helpers. Loads nothing by itself |
envless/env/load | Everything above, and it loads when it is required, so require it first |
envless/env/rails | A Railtie that loads before your Rails app is configured, and an envless view helper for client variables |
bundle exec envless-env types | Writes sig/envless-env.rbs, so Steep types every variable by name |
With Bundler, gem "envless-env" requires envless/env. Pass require: "envless/env/rails" in a Rails app, as the Rails page shows.
Design
Typed reads
A number reads back as an Integer, or a Float when it has a fraction, and a boolean as true or false. A missing name raises instead of returning nil, unless you read it through optional.
Secrets stay put
Envless.env refuses to be dumped, marshalled or printed with its values, so a log line or an error page shows a count, never a secret.
Ambient wins
A variable already set in ENV is never overwritten, and names that change how a process executes code, such as PATH, LD_PRELOAD or RUBYOPT, are never written at all.
Fast cold starts
The ciphertext is cached under ~/.envless/cache for 15 minutes, shared with @goenvless/env, so a restart skips the request and still decrypts in memory.