Skip to content
Dotenv loader for Crystal
Crystal
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
spec
src
.editorconfig
.gitignore
LICENSE
README.md
shard.yml

README.md

dotenvs

Small extension to cr-dotenv that loads .env files in the following order:

  1. .env
  2. .env.development - depends on environment
  3. .env.development.local - depends on environment, file should be excluded from repo

Installation

Add this to your application's shard.yml:

dependencies:
  dotenvs:
    github: qbart/dotenvs-cr

Usage

require "dotenvs"
Dotenvs.load("development")
Dotenvs.load(ENV["KEMAL_ENV"])
Dotenvs.load(ENV.fetch("KEMAL_ENV", "development"))
# ...

# production env is skipped, if you want to load .env files anyway, you can do:
Dotenvs.load(ENV["KEMAL_ENV"], allow_production: true) # default is false
You can’t perform that action at this time.