Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data DefaultEnv
- fromArgs :: (Read env, Show env, Enum env, Bounded env) => (env -> Object -> Parser extra) -> IO (AppConfig env extra)
- fromArgsSettings :: (Read env, Show env, Enum env, Bounded env) => (env -> IO (ConfigSettings env extra)) -> IO (AppConfig env extra)
- loadDevelopmentConfig :: IO (AppConfig DefaultEnv ())
- data AppConfig environment extra = AppConfig {}
- data ConfigSettings environment extra = ConfigSettings {}
- configSettings :: Show env => env -> ConfigSettings env ()
- loadConfig :: ConfigSettings environment extra -> IO (AppConfig environment extra)
- withYamlEnvironment :: Show e => FilePath -> e -> (Value -> Parser a) -> IO a
Documentation
data DefaultEnv Source #
A yesod-provided
, allows for Development, Testing, and
Production environmentsAppEnv
Instances
Bounded DefaultEnv Source # | |
Defined in Yesod.Default.Config minBound :: DefaultEnv # maxBound :: DefaultEnv # | |
Enum DefaultEnv Source # | |
Defined in Yesod.Default.Config succ :: DefaultEnv -> DefaultEnv # pred :: DefaultEnv -> DefaultEnv # toEnum :: Int -> DefaultEnv # fromEnum :: DefaultEnv -> Int # enumFrom :: DefaultEnv -> [DefaultEnv] # enumFromThen :: DefaultEnv -> DefaultEnv -> [DefaultEnv] # enumFromTo :: DefaultEnv -> DefaultEnv -> [DefaultEnv] # enumFromThenTo :: DefaultEnv -> DefaultEnv -> DefaultEnv -> [DefaultEnv] # | |
Read DefaultEnv Source # | |
Defined in Yesod.Default.Config readsPrec :: Int -> ReadS DefaultEnv # readList :: ReadS [DefaultEnv] # readPrec :: ReadPrec DefaultEnv # readListPrec :: ReadPrec [DefaultEnv] # | |
Show DefaultEnv Source # | |
Defined in Yesod.Default.Config showsPrec :: Int -> DefaultEnv -> ShowS # show :: DefaultEnv -> String # showList :: [DefaultEnv] -> ShowS # |
fromArgs :: (Read env, Show env, Enum env, Bounded env) => (env -> Object -> Parser extra) -> IO (AppConfig env extra) Source #
Load the app config from command line parameters
fromArgsSettings :: (Read env, Show env, Enum env, Bounded env) => (env -> IO (ConfigSettings env extra)) -> IO (AppConfig env extra) Source #
Load the app config from command line parameters, using the given @ConfigSettings.
Since 1.2.2
loadDevelopmentConfig :: IO (AppConfig DefaultEnv ()) Source #
Load your development config (when using
)DefaultEnv
data AppConfig environment extra Source #
Dynamic per-environment configuration which can be loaded at run-time negating the need to recompile between environments.
data ConfigSettings environment extra Source #
ConfigSettings | |
|
configSettings :: Show env => env -> ConfigSettings env () Source #
Default config settings.
loadConfig :: ConfigSettings environment extra -> IO (AppConfig environment extra) Source #
Load an
.AppConfig
Some examples:
-- typical local development Development: host: localhost port: 3000 -- approot: will default to ""
-- typical outward-facing production box Production: host: www.example.com -- port: will default 80 -- host: will default to "*" -- approot: will default "http://www.example.com"
-- maybe you're reverse proxying connections to the running app -- on some other port Production: port: 8080 approot: "http://example.com" host: "localhost"
:: Show e | |
=> FilePath | the yaml file |
-> e | the environment you want to load |
-> (Value -> Parser a) | what to do with the mapping |
-> IO a |
Loads the configuration block in the passed file named by the passed environment, yields to the passed function as a mapping.
Errors in the case of a bad load or if your function returns
Nothing
.