packages feed

dotenv 0.10.0.0 → 0.10.0.1

raw patch · 5 files changed

+22/−44 lines, 5 filesdep +mtlPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: mtl

API changes (from Hackage documentation)

- Configuration.Dotenv: ask :: Monad m => ReaderT r m r
- Configuration.Dotenv: data ReaderT r m a
- Configuration.Dotenv: liftReaderT :: m a -> ReaderT r m a

Files

CHANGELOG.md view
@@ -1,4 +1,8 @@ ## MASTER+## Dotenv 0.10.0.1+### Modified+* Modify docs.+ ## Dotenv 0.10.0.0 ### Modified * `loadFile` change return type (back to `m ()`)
dotenv.cabal view
@@ -1,42 +1,41 @@ name:                dotenv-version:             0.10.0.0+version:             0.10.0.1 synopsis:            Loads environment variables from dotenv files homepage:            https://github.com/stackbuilders/dotenv-hs description:   .   In most applications,-  <http://12factor.net/config configuration should be separated from code>.+  <https://12factor.net/config configuration should be separated from code>.   While it usually works well to keep configuration in the   environment, there are cases where you may want to store   configuration in a file outside of version control.   .-  "Dotenv" files have become popular for storing configuration,+  @Dotenv@ files have become popular for storing configuration,   especially in development and test environments. In   <https://github.com/bkeepers/dotenv Ruby>,   <https://github.com/theskumar/python-dotenv Python> and-  <https://www.npmjs.com/package/dotenv Javascript> there are libraries+  <https://www.npmjs.com/package/dotenv JavaScript> there are libraries   to facilitate loading of configuration options from configuration   files. This library loads configuration to environment variables for   programs written in Haskell.   .   To use, call `loadFile` from your application:   .-  > import Control.Monad (void)   > import Configuration.Dotenv-  > void $ loadFile defaultConfig+  > loadFile defaultConfig   .   This package also includes an executable that can be used   to inspect the results of applying one or more Dotenv files   to the environment, or for invoking your executables with   an environment after one or more Dotenv files is applied.   .-  See the <https://github.com/stackbuilders/dotenv-hs Github>+  See the <https://github.com/stackbuilders/dotenv-hs#readme Github>   page for more information on this package. license:             MIT license-file:        LICENSE author:              Justin Leitgeb maintainer:          hackage@stackbuilders.com-copyright:           2015-2020 Stack Builders Inc.+copyright:           2015-Present Stack Builders Inc. category:            Configuration build-type:          Simple extra-source-files:    spec/fixtures/.dotenv@@ -90,7 +89,6 @@                       , Configuration.Dotenv.Types    build-depends:         base >= 4.9 && < 5.0-                       , base-compat >= 0.4                        , directory                        , megaparsec >= 7.0.1 && < 10.0                        , containers@@ -98,6 +96,7 @@                        , shellwords >= 0.1.3.0                        , text                        , exceptions >= 0.8 && < 0.11+                       , mtl >= 2.3 && < 2.4    hs-source-dirs:      src   ghc-options:         -Wall@@ -133,6 +132,7 @@                      , text                      , exceptions >= 0.8 && < 0.11                      , hspec-megaparsec >= 2.0 && < 3.0+                     , mtl    build-tools:        hspec-discover   >= 2.0 && < 3.0 
src/Configuration/Dotenv.hs view
@@ -24,13 +24,12 @@                                                       setEnv) import           Configuration.Dotenv.Parse          (configParser) import           Configuration.Dotenv.ParsedVariable (interpolateParsedVariables)-import           Configuration.Dotenv.Types          (Config (..), ReaderT, ask,-                                                      defaultConfig,-                                                      liftReaderT, runReaderT)+import           Configuration.Dotenv.Types          (Config (..), defaultConfig)+import           Control.Monad.Trans                 (lift)+import           Control.Monad.Reader                (ReaderT, ask, runReaderT) import           Control.Exception                   (throw)-import           Control.Monad                       (when)+import           Control.Monad                       (unless, when) import           Control.Monad.Catch-import           Control.Monad.Compat                (unless) import           Control.Monad.IO.Class              (MonadIO (..)) import           Data.List                           (intersectBy, union,                                                       unionBy)@@ -98,12 +97,12 @@   if configOverride     then info kv >> setEnv'     else do-      res <- liftReaderT . liftIO $ lookupEnv k+      res <- lift . liftIO $ lookupEnv k       case res of         Nothing -> info kv >> setEnv'         Just _  -> return kv   where-    setEnv' = liftReaderT . liftIO $ setEnv k v >> return kv+    setEnv' = lift . liftIO $ setEnv k v >> return kv  -- | The function logs in console when a variable is loaded into the -- environment.@@ -111,7 +110,7 @@ info (key, value) = do   Config {..} <- ask   when configVerbose $-    liftReaderT . liftIO $+    lift . liftIO $     putStrLn $ "[INFO]: Load env '" ++ key ++ "' with value '" ++ value ++ "'"  -- | The helper allows to avoid exceptions in the case of missing files and
src/Configuration/Dotenv/Environment.hs view
@@ -15,9 +15,11 @@ #endif  #if MIN_VERSION_base(4,11,0)+-- | Re-export "System.Environment" or "System.Environment.Blank" helpers. lookupEnv :: String -> IO (Maybe String) lookupEnv = getEnv +-- | Re-export "System.Environment" or "System.Environment.Blank" helpers. setEnv :: String -> String -> IO () setEnv name value = Blank.setEnv name value True #endif
src/Configuration/Dotenv/Types.hs view
@@ -12,10 +12,6 @@ module Configuration.Dotenv.Types   ( Config(..)   , defaultConfig-  , ask-  , runReaderT-  , liftReaderT-  , ReaderT   )   where @@ -39,26 +35,3 @@     , configVerbose = False     , allowDuplicates = True     }---newtype ReaderT r m a = ReaderT { runReaderT :: r -> m a }-mapReaderT :: (m a -> n b) -> ReaderT r m a -> ReaderT r n b-mapReaderT f m = ReaderT $ f . runReaderT m-instance (Functor m) => Functor (ReaderT r m) where-    fmap f  = mapReaderT (fmap f)-instance (Applicative m) => Applicative (ReaderT r m) where-    pure    = liftReaderT . pure-    f <*> v = ReaderT $ \ r -> runReaderT f r <*> runReaderT v r--instance (Monad m) => Monad (ReaderT r m) where-    return   = liftReaderT . return-    m >>= k  = ReaderT $ \ r -> do-      a <- runReaderT m r-      runReaderT (k a) r-    m >> k = ReaderT $ \ r -> runReaderT m r >> runReaderT k r--liftReaderT :: m a -> ReaderT r m a-liftReaderT m = ReaderT (const m)--ask :: (Monad m) => ReaderT r m r-ask = ReaderT return