- data DefaultEnv
- = Development
- | Testing
- | Staging
- | Production
- fromArgs :: IO (AppConfig DefaultEnv ())
- fromArgsExtra :: (DefaultEnv -> TextObject -> IO extra) -> IO (AppConfig DefaultEnv extra)
- loadDevelopmentConfig :: IO (AppConfig DefaultEnv ())
- data AppConfig environment extra = AppConfig {}
- data ConfigSettings environment extra = ConfigSettings {
- csEnv :: environment
- csLoadExtra :: environment -> TextObject -> IO extra
- csFile :: environment -> IO FilePath
- csGetObject :: environment -> TextObject -> IO TextObject
- configSettings :: Show env => env -> ConfigSettings env ()
- loadConfig :: ConfigSettings environment extra -> IO (AppConfig environment extra)
- withYamlEnvironment :: Show e => FilePath -> e -> (TextObject -> IO a) -> IO a
Documentation
data DefaultEnv Source
A yesod-provided
, allows for Development, Testing, and
Production environments
AppEnv
fromArgs :: IO (AppConfig DefaultEnv ())Source
Load an
using the AppConfig
environments from
commandline arguments.
DefaultEnv
fromArgsExtra :: (DefaultEnv -> TextObject -> IO extra) -> IO (AppConfig DefaultEnv extra)Source
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 -- ssl: will default false -- approot: will default to "http://localhost:3000"
-- typical outward-facing production box Production: host: www.example.com -- ssl: will default false -- port: will default 80 -- 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" -- approot is specified so that the non-80 port is not appended -- automatically.
:: Show e | |
=> FilePath | the yaml file |
-> e | the environment you want to load |
-> (TextObject -> IO a) | what to do with the mapping |
-> IO a |
Loads the configuration block in the passed file named by the passed environment, yeilds to the passed function as a mapping.
Errors in the case of a bad load or if your function returns
Nothing
.