freckle-app 1.2.0.1 → 1.2.0.2
raw patch · 4 files changed
+26/−8 lines, 4 files
Files
- CHANGELOG.md +5/−1
- freckle-app.cabal +1/−1
- library/Freckle/App/Env.hs +19/−5
- package.yaml +1/−1
CHANGELOG.md view
@@ -1,4 +1,8 @@-## [_Unreleased_](https://github.com/freckle/freckle-app/compare/v1.2.0.1...main)+## [_Unreleased_](https://github.com/freckle/freckle-app/compare/v1.2.0.2...main)++## [v1.2.0.2](https://github.com/freckle/freckle-app/compare/v1.2.0.1...v1.2.0.2)++- `Env.kept` compatibility with envparse-0.5 ## [v1.2.0.1](https://github.com/freckle/freckle-app/compare/v1.2.0.0...v1.2.0.1)
freckle-app.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: freckle-app-version: 1.2.0.1+version: 1.2.0.2 license: MIT license-file: LICENSE maintainer: Freckle Education
library/Freckle/App/Env.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ -- | Parse the shell environment for configuration -- -- A minor extension of [envparse](https://hackage.haskell.org/package/envparse).@@ -76,14 +78,26 @@ flag :: Off a -> On a -> String -> Mod Flag a -> Parser Error a flag (Off f) (On t) n m = Env.flag f t n m --- | Modify a 'Parser' so all variables are as if they used 'keep'+-- | Modify a 'Parser' so variables are never removed after reading ----- By default, read variables are removed from the environment. This is often--- problematic (e.g. in tests that repeatedly load an app and re-read the--- environment), and the security benefits are minor.+-- In @envparse-0.4@, read variables are removed from the environment by+-- default. This is often problematic (e.g. in tests that repeatedly load an app+-- and re-read the environment), and the security benefits are minor. This+-- function will make them all behave as if @keep@ was used. --+-- In @envparse-0.5@, the default is reversed and @sensitive@ can be used to+-- explicitly unset read variables, and so this function will instead make them+-- all behave as if @sensitive@ was /not/ used.+-- kept :: Parser e a -> Parser e a-kept = Parser . hoistAlt (\v -> v { varfKeep = True }) . unParser+kept = Parser . hoistAlt go . unParser+ where+ go v =+#if MIN_VERSION_envparse(0,5,0)+ v { varfSensitive = False }+#else+ v { varfKeep = True }+#endif -- | Create a 'Reader' from a simple parser function --
package.yaml view
@@ -1,6 +1,6 @@ --- name: freckle-app-version: 1.2.0.1+version: 1.2.0.2 maintainer: Freckle Education category: Utils github: freckle/freckle-app