-- |
-- Module      :  Configuration.Dotenv.Types
-- Copyright   :  © 2015–2020 Stack Builders Inc.
-- License     :  MIT
--
-- Maintainer  :  Stack Builders <hackage@stackbuilders.com>
-- Stability   :  experimental
-- Portability :  portable
--
-- Provides the types with extra options for loading a dotenv file.

module Configuration.Dotenv.Types
  ( Config(..)
  , defaultConfig
  )
  where

-- | Configuration Data Types with extra options for executing dotenv.
data Config = Config
  { Config -> [FilePath]
configPath        :: [FilePath] -- ^ The paths for the .env files
  , Config -> [FilePath]
configExamplePath :: [FilePath] -- ^ The paths for the .env.example files
  , Config -> Bool
configOverride    :: Bool     -- ^ Flag to allow override env variables
  } deriving (Config -> Config -> Bool
(Config -> Config -> Bool)
-> (Config -> Config -> Bool) -> Eq Config
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Config -> Config -> Bool
$c/= :: Config -> Config -> Bool
== :: Config -> Config -> Bool
$c== :: Config -> Config -> Bool
Eq, Int -> Config -> ShowS
[Config] -> ShowS
Config -> FilePath
(Int -> Config -> ShowS)
-> (Config -> FilePath) -> ([Config] -> ShowS) -> Show Config
forall a.
(Int -> a -> ShowS) -> (a -> FilePath) -> ([a] -> ShowS) -> Show a
showList :: [Config] -> ShowS
$cshowList :: [Config] -> ShowS
show :: Config -> FilePath
$cshow :: Config -> FilePath
showsPrec :: Int -> Config -> ShowS
$cshowsPrec :: Int -> Config -> ShowS
Show)

-- | Default configuration. Use .env file without .env.example strict envs and
-- without overriding.
defaultConfig :: Config
defaultConfig :: Config
defaultConfig =
  Config :: [FilePath] -> [FilePath] -> Bool -> Config
Config
    { configExamplePath :: [FilePath]
configExamplePath = []
    , configOverride :: Bool
configOverride = Bool
False
    , configPath :: [FilePath]
configPath = [ FilePath
".env" ]
    }