Skip to content
/ env Public

An extremely simple library to support env files

License

Notifications You must be signed in to change notification settings

WildSource/env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Env

An extremely simple library to support env files. This library is meant to be used with the basic environment variable support that Haskell has (System.Environment).

Installation

This package is not on hackage but cabal (and stack) let's you use packages that are on github. (I don't use stack so you will have to figure it out yourself)

  1. Create cabal.project file if you don't have one already at the root of your project. Essentially at the same location as your .cabal file and put this in the cabal.project file.
    packages: .
    
    source-repository-package
    type: git
    location: https://github.com/WildSource/env
    tag: v0.1.1.0
    
  2. Add the library to your .cabal file.
    -- Other library packages from which modules are imported.
     build-depends:    base ^>=4.20.0.0,
                       env
    
  3. Execute the cabal update and cabal build commands and you should be good to go.

Usage

  1. import the library (import Env) and System.Environment (we need getEnv)
import Env
import System.Environment
  1. use the loadEnv or loadEnvFile function
loadEnv

or

loadEnvFile "pathToEnv.env"
  1. to get your values just use the getEnv "nameOfKey" from System.Environment

inside the env file -> HELLO=WORLD

getEnv "HELLO"

output

"WORLD"

About

An extremely simple library to support env files

Resources

License

Stars

Watchers

Forks

Packages

No packages published