packages feed

freckle-app 1.2.0.0 → 1.2.0.1

raw patch · 5 files changed

+34/−5 lines, 5 files

Files

CHANGELOG.md view
@@ -1,4 +1,21 @@-## [_Unreleased_](https://github.com/freckle/freckle-app/compare/v1.2.0.0...main)+## [_Unreleased_](https://github.com/freckle/freckle-app/compare/v1.2.0.1...main)++## [v1.2.0.1](https://github.com/freckle/freckle-app/compare/v1.2.0.0...v1.2.0.1)++- Use `Env.kept` with parsing that occurs in `makePostgresPool`++  This ensure all `PG` variables are kept in the environment after parsing, to+  again match pre-v1.1 behavior.++  If you would prefer not to keep these variables, parse them yourself (e.g.+  with `envParseDatabaseConf`) and use `makePostgresPoolWith`.++- Add `Freckle.App.Env.kept` to re-define a `Parser` so that all variables are+  kept after reading. Not doing this can break tests if you are re-parsing the+  environment for each example.++  Replace `Env.parse f` with `Env.parse f $ Env.kept` to recover how this module+  behaved prior to v1.1.  ## [v1.2.0.0](https://github.com/freckle/freckle-app/compare/v1.1.0.0...v1.2.0.0) 
freckle-app.cabal view
@@ -1,6 +1,6 @@ cabal-version:      1.18 name:               freckle-app-version:            1.2.0.0+version:            1.2.0.1 license:            MIT license-file:       LICENSE maintainer:         Freckle Education
library/Freckle/App/Database.hs view
@@ -60,8 +60,8 @@ makePostgresPool :: (MonadUnliftIO m, MonadLoggerIO m) => m SqlPool makePostgresPool = do   conf <- liftIO $ do-    postgresPasswordSource <- Env.parse id envPostgresPasswordSource-    Env.parse id (envParseDatabaseConf postgresPasswordSource)+    postgresPasswordSource <- Env.parse id $ Env.kept envPostgresPasswordSource+    Env.parse id $ Env.kept $ envParseDatabaseConf postgresPasswordSource   makePostgresPoolWith conf  runDB
library/Freckle/App/Env.hs view
@@ -27,6 +27,7 @@   , flag    -- * Extensions+  , kept   , eitherReader   , time   , keyValues@@ -39,6 +40,8 @@ import Data.Time (defaultTimeLocale, parseTimeM) import Env hiding (flag) import qualified Env+import Env.Internal.Free (hoistAlt)+import Env.Internal.Parser (Parser(..), VarF(..))  -- | Designates the value of a parameter when a flag is not provided. newtype Off a = Off a@@ -72,6 +75,15 @@ -- 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'+--+-- 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.+--+kept :: Parser e a -> Parser e a+kept = Parser . hoistAlt (\v -> v { varfKeep = True }) . unParser  -- | Create a 'Reader' from a simple parser function --
package.yaml view
@@ -1,6 +1,6 @@ --- name: freckle-app-version: 1.2.0.0+version: 1.2.0.1 maintainer: Freckle Education category: Utils github: freckle/freckle-app