gdotdesign / cr-dotenv Goto Github PK
View Code? Open in Web Editor NEWLoads ".env" files
License: MIT License
Loads ".env" files
License: MIT License
I get this compile error with crystal 0.34
Unhandled exception: Parse error on line 2:5 (Dotenv::Parser::Error)
from lib/dotenv/src/parser.cr:33:11 in 'parse'
from lib/dotenv/src/dotenv.cr:24:5 in 'parse'
from lib/dotenv/src/dotenv.cr:114:7 in 'load'
Now it override existing variables, it should by default not load variable from .env if variable already defined. Other implementations works in this way.
ruby https://github.com/bkeepers/dotenv#why-is-it-not-overriding-existing-env-variables
nodejs https://www.npmjs.com/package/dotenv#what-happens-to-environment-variables-that-were-already-set
Is there a way to override the ENV once it's loaded?
#.env
DB_URL=postgres://localhost:5432/dev
#.env.test
DB_URL=postgres://localhost:5432/test
require "dotenv"
Dotenv.load
Dotenv.load ".env.test"
puts ENV["DB_URL"]? #=> postgres://localhost:5432/dev
Quotes should be handled
now
NAME="value"
loaded as in code as
ENV["NAME"] == "\"value\""
it should be
ENV["NAME"] == "value"
I noticed in the code you do File.open
but never close the file. That file descriptor will be forever occupied for the rest of the program.
Line 99 in ca17a9b
Please consider using the block form, File.open(filename) { do_something_here }
to make sure the file is closed after you use it.
Please add GitHub releases regarding to crystal-lang/shards#161.
Currently on doing shards update, I am getting a missing version warning;
rishav@rishav-sbook:~/digglu$ shards update
Resolving dependencies
Fetching https://github.com/will/crystal-pg.git
Fetching https://github.com/gdotdesign/cr-dotenv.git
Fetching https://github.com/crystal-community/jwt.git
Fetching https://github.com/evanhahn/crystal-helmet.git
Fetching https://github.com/crystal-lang/crystal-db.git
Fetching https://github.com/spider-gazelle/openssl_ext.git
Unable to satisfy the following requirements:
- `crystal (>= 0.35.0, < 2.0.0)` required by `pg 0.23.2`
- `crystal (>= 0.34.0, < 2.0.0)` required by `dotenv 1.0.0`
- `crystal (>= 0.36.1)` required by `jwt 1.5.1`
- `crystal (< 1.0.0)` required by `helmet 0.2.2`
- `crystal (>= 0.35.0, < 2.0.0)` required by `db 0.10.1`
- `crystal (>= 0.36.1)` required by `openssl_ext 2.1.4`
Failed to resolve dependencies, try updating incompatible shards or use --ignore-crystal-version as a workaround if no update is available.
There more info here https://forum.crystal-lang.org/t/weird-shards-outdated-output-crystal-1-0-0/3065
Essentially this is an explicit check to ensure that a library works with Crystal 1.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.