No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
spec-spec Make Env#name public Nov 20, 2017
spec Make Env#name public Nov 20, 2017
src Add environment name validation Nov 20, 2017
.editorconfig initial commit Nov 10, 2017
.gitignore initial commit Nov 10, 2017
.travis.yml initial commit Nov 10, 2017
LICENSE initial commit Nov 10, 2017
README.md Make Env#name public Nov 20, 2017
shard.yml initial commit Nov 10, 2017

README.md

crystal-env

This shard provides environment detection. The selected environment is configured using CRYSTAL_ENV environment variable.

Installation

Add this to your application's shard.yml:

dependencies:
  env:
    github: crystal-lang/crystal-env

Usage

  • Add the following require in the application code. The default environment will be development.
require "env"
  • In the spec/spec_helper.cr require env/spec before your app code. When running crystal spec the default environment will be test.
require "spec"
require "env/spec"
require "../your-app"
  • Use the following methods to detect the environment

    • Crystal.env.development?
    • Crystal.env.production?
    • Crystal.env.test?
  • Use the following method to get name the environment

    • Crystal.env.name
  • Set CRYSTAL_ENV to development, production or test

Contributors

  • bcardiff Brian J. Cardiff - creator, maintainer