load-env 0.1.0 → 0.1.1
raw patch · 2 files changed
+46/−27 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- load-env.cabal +27/−26
- src/LoadEnv/Parse.hs +19/−1
load-env.cabal view
@@ -1,41 +1,42 @@-Name: load-env-Version: 0.1.0-Author: Pat Brisbin <pbrisbin@gmail.com>-Maintainer: Pat Brisbin <pbrisbin@gmail.com>-License: BSD3-License-File: LICENSE-Synopsis: Load environment variables from a file.-Description: Parse a .env file and load any declared variables into+name: load-env+version: 0.1.1+author: Pat Brisbin <pbrisbin@gmail.com>+maintainer: Pat Brisbin <pbrisbin@gmail.com>+license: BSD3+license-file: LICENSE+synopsis: Load environment variables from a file.+category: Configuration+description: Parse a .env file and load any declared variables into the current process's environment. This allows for a .env file to specify development-friendly defaults for configuration values normally set in the deployment environment.-Cabal-Version: >= 1.10-Build-Type: Simple+cabal-version: >= 1.10+build-type: Simple -Library- Default-Language: Haskell2010- HS-Source-Dirs: src- GHC-Options: -Wall- Exposed-Modules: LoadEnv+library+ default-language: Haskell2010+ hs-source-dirs: src+ ghc-options: -Wall+ exposed-modules: LoadEnv , LoadEnv.Parse- Build-Depends: base >= 4.7.0 && < 5+ build-depends: base >= 4.7.0 && < 5 , directory , parsec -Test-Suite spec- Type: exitcode-stdio-1.0- Default-Language: Haskell2010- Hs-Source-Dirs: test- Ghc-Options: -Wall- Main-Is: Spec.hs- Build-Depends: base+test-suite spec+ type: exitcode-stdio-1.0+ default-language: Haskell2010+ hs-source-dirs: test+ ghc-options: -Wall+ main-is: Spec.hs+ build-depends: base , load-env , directory , hspec , HUnit , parsec -Source-Repository head- Type: git- Location: https://github.com/pbrisbin/load-env+source-repository head+ type: git+ location: https://github.com/pbrisbin/load-env
src/LoadEnv/Parse.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} module LoadEnv.Parse ( Environment , Variable@@ -5,7 +6,10 @@ , parseVariable ) where +#if __GLASGOW_HASKELL__ < 710 import Control.Applicative ((<$>))+#endif+ import Control.Monad (void) import Data.Maybe (catMaybes) @@ -42,8 +46,22 @@ return (i, v) +-- Environment variable names used by the utilities in the Shell and Utilities+-- volume of IEEE Std 1003.1-2001 consist solely of uppercase letters, digits,+-- and the '_' (underscore) from the characters defined in Portable Character+-- Set and do not begin with a digit.+--+-- <http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap08.html>+-- identifier :: Parser String-identifier = many1 $ letter <|> char '_'+identifier = do+ x <- upper <|> underscore+ ys <- many $ upper <|> digit <|> underscore++ return (x:ys)++ where+ underscore = char '_' value :: Parser String value = quotedValue <|> unquotedValue <|> return ""