Haskell: Why are my environment variables not available when running my project under cabal? -


does know how define environment variables accessed program run cabal?

i want define system environment variables available program, e.g. via system.environment's 'getenv' function. variables available 'getenv' in ghci, not program run cabal ('cabal run').

i define environment variables as:

$ export myvar=myvalue 

accessing them works in ghci:

prelude system.environment> getenv "myvar" "myvalue" 

however, using 'getenv' in program , running 'cabal run' gives error:

getenv: not exist (no environment variable) 

somehow program not finding them when run via cabal. tried placing 'export' statements in .bash_profile , restarting terminal. gave same issue of working in ghci , giving error when run cabal.

thanks comments, realized due stupid mistake me.

my program used couple different environment variables, of being read -- error due missing 1 hadn't tested in ghci.

so issue due not testing variables, silly mistake, comments anyway helpful in diagnosing issue.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -