crystal-env
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:
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.crrequirecrystal-env/specbefore your app code. When runningcrystal specthe default environment will betest.
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_ENVtodevelopment,productionortest
Contributors
- bcardiff Brian J. Cardiff - creator, maintainer
Repository
crystal-env
Owner
Statistic
- 14
- 3
- 2
- 8
- 0
- about 3 years ago
- November 20, 2017
License
MIT License
Links
Synced at
Tue, 04 Nov 2025 06:58:32 GMT
Languages