Comments (7)
I do think we should care about windows support. There are some Haskell developers that use Windows and may found this library useful.
I had this concern a long time ago, you can check #7. I think the only solution for compatibility is using CPP.
from dotenv-hs.
Dotenv has implementations in many other languages. Can someone check what other implementations do for this case? Once we gather that information, we can choose behavior for dotenv-hs - preferably, something that is relatively flexible and safe.
from dotenv-hs.
I've tried the following .env
file
FOO=
BAR=1234
with js dotenv
require('dotenv').config();
if(process.env.FOO === undefined){
console.log("Foo is not set");
} else {
console.log("Foo is set");
}
console.log('Foo', process.env.FOO);
console.log('Bar:', process.env.BAR);
and ruby dotenv.
require 'dotenv'
Dotenv.load('.env')
if ENV['FOO'].nil?
print("Foo is not set\n")
else
print("Foo is set\n")
end
print('FOO: ' + ENV['FOO'] + "\n")
print('BAR: ' + ENV['BAR'] + "\n")
In both cases the output is:
Foo is set
FOO:
BAR: 1234
Looking into the code, it seems they only use their own basic libraries to manage environmental variables:
from dotenv-hs.
Just in case, I did the same example with dotenv-hs:
import Configuration.Dotenv
import System.Environment
main :: IO ()
main = do
loadFile False ".env"
foo <- lookupEnv "FOO"
bar <- lookupEnv "BAR"
case foo of
Nothing -> putStrLn "Foo is not set"
Just _ -> putStrLn "Foo is set"
putStrLn ("Foo: " ++ show foo)
putStrLn ("Bar: " ++ show bar)
And I got the following output:
Foo is not set
Foo: Nothing
Bar: Just "1234"
from dotenv-hs.
Wasn't there a related issue on this repository about blank environment variables not being set by dotenv-hs
?
I remember commenting on that with a workaround (because it was a wontfix to preserve Windows compatibility), but that only works on Haskell source files. It won't work if you need to load your .env
file with something like dotenv -f .env -- command
(for example, with supporting scripts).
I think being able to have blank environment variables is useful, and I kind of resent the fact that this Windows is acting as a lowest common denominator here (no offence to the team here, I can understand why you made the decision).
from dotenv-hs.
@habibalamin Yeah, there is a PR (#7) where we discussed a little bit about it. I think it is good to have an issue open. We can have further discussions.
from dotenv-hs.
Closing this issue because of #51 (comment)
from dotenv-hs.
Related Issues (20)
- Fix static file generation on CI HOT 1
- Verbose option (for CLI and command) HOT 4
- Allow/Forbid duplicated env variables in file HOT 2
- `loadFile` return value HOT 3
- Release GH Action fails but doesn't stop the workflow
- Make parsing function available in cabal package HOT 5
- Add a flag to allow verification of environment variables before program execution HOT 2
- Introduce a .dotenv.config file to store and read flags for Dotenv CLI HOT 1
- Add All Contributors HOT 1
- Support optparse-applicative 0.18 HOT 2
- How to provide JSON as a value to the env var HOT 5
- Release 0.11.0.2 to Hackage? HOT 3
- Review warnings on Publish Release HOT 6
- Be able to do variable substitution when the content is inside quotes HOT 1
- Parse content that starts with curly brackets HOT 2
- Document .env search behavior in Cabal monorepo HOT 4
- Add basic use case or example HOT 1
- Rename `master` branch to `main`
- parseFile doesn't seem to escape characters as expected HOT 3
- Use `kleidukos/get-tested` and include GHC supported versions in cabal file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotenv-hs.