lucky_env
Version, currently 0.3.07 versions
github.com/luckyframework/lucky_env
An environment variable manager
6 stars
19 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
lucky_env:
github: luckyframework/lucky_env
version: ~> 0.3.0Then run:
shards installshard.yml
- Crystal
>= 1.10.0- License
- MIT
- Author
- Jeremy Woertink
Dependencies
Development Dependencies
- ameba~> 1.5.0github: crystal-ameba/amebadev
README
LuckyEnv
Yet another environment variable manager. Read from a file like a .env
Installation
- Add the dependency to your
shard.yml:
dependencies:
lucky_env:
github: luckyframework/lucky_env
- Run
shards install
Usage
Environment variable file
Create your "env" file. Name it whatever you want. Most common is .env.
The file is created with key/value pairs separated by =.
APP_NAME=my_app
LUCKY_ENV=development
DEV_PORT=3002
DB_NAME=${APP_NAME}_${LUCKY_ENV}
Crystal code
# This would normally go in your `src/shards.cr` file
require "lucky_env"
# Loads the ".env" file. Raises if it is missing
LuckyEnv.load(".env")
# Use `load?` if the file is optional.
# This will not raise if the file is missing
LuckyEnv.load?(".env")
ENV["LUCKY_ENV"] == "development" # => true
# Returns whatever `ENV["LUCKY_ENV"]` is set to, or `"development"` if not set.
LuckyEnv.environment # => "development"
# Environment predicates
LuckyEnv.development? # => true
LuckyEnv.production? # => false
LuckyEnv.test? # => false
Development
Install shards shards install, and start making changes.
Be sure to run ./bin/ameba, and the crystal formatter crystal tool format spec src.
Read through the issues for things you can work on. If you have an idea, feel free to open a new issue!
Contributing
- Fork it (https://github.com/luckyframework/lucky_env/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Jeremy Woertink - creator and 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.3.0- Tagged
- Jun 1, 2025
- Commit
ea76de6de5db- Crystal
>= 1.10.0- Indexed
- yes
Dependents
- penny
- website_v2
- lucky_diff
- carbon_send_in_blue_adapter
- shield
- samba
- lucky_vite
- bill
- lucille
- carbon
- carbon_sendgrid_adapter
- linkybits
and 7 more
Repository
github.com/luckyframework/lucky_env
Metadata
- Created
- Aug 16, 2026
- Updated
- Aug 16, 2026
- Synced
- Aug 16, 2026
- Versions
- 7