crystal-env
Version, currently 0.1.01 version
- 0.1.0latestJan 11, 2021
github.com/crystal-lang/crystal-env
No description declared in shard.yml.
14 stars
4 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
crystal-env:
github: crystal-lang/crystal-env
version: ~> 0.1.0Then run:
shards installshard.yml
- Crystal
0.35.1- License
- MIT
- Author
- Brian J. Cardiff
Dependencies
This version declares no dependencies.
README
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
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.0- Tagged
- Jan 11, 2021
- Commit
be17067ae807- Crystal
0.35.1- Indexed
- yes
Dependents
Repository
github.com/crystal-lang/crystal-env
Metadata
- Created
- Aug 12, 2026
- Updated
- Sep 28, 2026
- Synced
- Sep 28, 2026
- Versions
- 1