This project was created by a developer from Ukraine.

Russia has invaded Ukraine and already killed tens of thousands of civilians, with many more raped or tortured.

The death toll keeps climbing. It's a genocide. We need your help. Let's fight back against the Russian regime.

Support Ukraine

#StandWithUkraine

This project was created by a developer from Ukraine.

Russia has invaded Ukraine and already killed tens of thousands of civilians,

with many more raped or tortured. It's a genocide. We need your help.

Support Ukraine

#StandWithUkraine

crystal-env

crystal-env

CI

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:
  crystal-env:
    github: crystal-lang/crystal-env

Usage

  • Add the following require in the application code. The default environment will be development.
require "crystal-env"
  • In the spec/spec_helper.cr require crystal-env/spec before your app code. When running crystal spec the default environment will be test.
require "spec"
require "crystal-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
Owner
github statistic
  • 11
  • 4
  • 1
  • 1
  • 9 months ago
  • November 20, 2017
License

MIT License

Links
Synced at

Mon, 08 Aug 2022 16:52:58 GMT