load-env 0.2.0.1 → 0.2.0.2
raw patch · 4 files changed
+62/−11 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +44/−1
- load-env.cabal +2/−2
- src/LoadEnv/Parse.hs +12/−6
- test/LoadEnv/ParseSpec.hs +4/−2
CHANGELOG.md view
@@ -1,1 +1,44 @@-TODO+## [*Unreleased*](https://github.com/pbrisbin/load-env/compare/v0.2.0.2...master)++None++## [v0.2.0.2](https://github.com/pbrisbin/load-env/compare/v0.2.0.1...v0.2.0.2)++- Allow lower-case characters in variable names [@denibertovic](https://github.com/pbrisbin/load-env/pull/4)++## [v0.2.0.1](https://github.com/pbrisbin/load-env/compare/v0.2.0.0...v0.2.0.1)++- Packaging and documentation updates++## [v0.2.0.0](https://github.com/pbrisbin/load-env/compare/v0.1.2...v0.2.0.0)++- Traverse up parent directories to find the `.env` file++## [v0.1.2](https://github.com/pbrisbin/load-env/compare/v0.1.1...v0.1.2)++- Packaging updates++## [v0.1.1](https://github.com/pbrisbin/load-env/compare/v0.1.0...v0.1.1)++- Parse variables names more strictly++## [v0.1.0](https://github.com/pbrisbin/load-env/compare/v0.0.4...v0.1.0)++- Don't fail on an empty file+- Ignore any invalid lines, not specifically things that look like comments++## [v0.0.4](https://github.com/pbrisbin/load-env/compare/v0.0.3...v0.0.4)++- Don't throw an exception if the `.env` file is missing++## [v0.0.3](https://github.com/pbrisbin/load-env/compare/v0.0.2...v0.0.3)++- Variable names can contain underscores++## [v0.0.2](https://github.com/pbrisbin/load-env/compare/v0.0.1...v0.0.2)++- Drop support for GHC < 7.8++## [v0.0.1](https://github.com/pbrisbin/load-env/tree/v0.0.1)++Initial release.
load-env.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 2e4f7d0d54d77f91f6586cbaae5aef26c673de9f74d2d3b0447d42773e3630c0+-- hash: c39eb0ad2f6482017271ab93ef8f962a61068806291ebaa457c3fa6f3dd34055 name: load-env-version: 0.2.0.1+version: 0.2.0.2 synopsis: Load environment variables from a file. 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. category: Configuration
src/LoadEnv/Parse.hs view
@@ -38,16 +38,22 @@ pure (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.+-- volume of POSIX.1-2017 consist solely of uppercase letters, digits,+-- and the <underscore> ( '_' ) from the characters defined in Portable+-- Character Set and do not begin with a digit. Other characters may be+-- permitted by an implementation; applications shall tolerate the presence+-- of such names. Uppercase and lowercase letters shall retain their unique+-- identities and shall not be folded together. The name space of environment+-- variable names containing lowercase letters is reserved for applications.+-- Applications can define any environment variables with names from this name+-- space without modifying the behavior of the standard utilities. ----- <http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap08.html>+-- <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html> -- identifier :: Parser String identifier = do- x <- upper <|> underscore- ys <- many $ upper <|> digit <|> underscore+ x <- upper <|> lower <|> underscore+ ys <- many $ upper <|> lower <|> digit <|> underscore pure (x:ys)
test/LoadEnv/ParseSpec.hs view
@@ -97,13 +97,15 @@ `shouldBe` Right ("S3_KEY", "abc123") parse parseVariable "" "_S3_KEY=abc123\n" `shouldBe` Right ("_S3_KEY", "abc123")+ parse parseVariable "" "S3_key=abc123\n"+ `shouldBe` Right ("S3_key", "abc123")+ parse parseVariable "" "s3_key=abc123\n"+ `shouldBe` Right ("s3_key", "abc123") parse parseVariable "" "S3~KEY=abc123\n" `shouldContainError` "unexpected \"~\"" parse parseVariable "" "S3-KEY=abc123\n" `shouldContainError` "unexpected \"-\""- parse parseVariable "" "S3_key=abc123\n"- `shouldContainError` "unexpected \"k\"" parse parseVariable "" "3_KEY=abc123\n" `shouldContainError` "unexpected \"3\""