Coder Social home page Coder Social logo

Comments (7)

CristhianMotoche avatar CristhianMotoche commented on June 4, 2024

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.

jsl avatar jsl commented on June 4, 2024

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.

CristhianMotoche avatar CristhianMotoche commented on June 4, 2024

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.

CristhianMotoche avatar CristhianMotoche commented on June 4, 2024

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.

habibalamin avatar habibalamin commented on June 4, 2024

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.

CristhianMotoche avatar CristhianMotoche commented on June 4, 2024

@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.

CristhianMotoche avatar CristhianMotoche commented on June 4, 2024

Closing this issue because of #51 (comment)

from dotenv-hs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.