Yesod.Default.Config2

yesod-1.4.2: Creation of type-safe, RESTful web applications.

Safe Haskell | None
Language | Haskell98

Yesod.Default.Config2

Description

Some next-gen helper functions for the scaffolding's configuration system.

Synopsis

- newtype MergedValue = MergedValue {
  - getMergedValue :: Value
  }
- applyCurrentEnv :: Bool -> Value -> IO Value
- getCurrentEnv :: IO (HashMap Text Text)
- applyEnvValue :: Bool -> HashMap Text Text -> Value -> Value
- loadAppSettings :: FromJSON settings => [FilePath] -> [Value] -> EnvUsage -> IO settings
- loadAppSettingsArgs :: FromJSON settings => [Value] -> EnvUsage -> IO settings
- configSettingsYml :: FilePath
- getDevSettings :: Settings -> IO Settings
- develMainHelper :: IO (Settings, Application) -> IO ()
- makeYesodLogger :: LoggerSet -> IO Logger
- data EnvUsage
- ignoreEnv :: EnvUsage
- useEnv :: EnvUsage
- requireEnv :: EnvUsage
- useCustomEnv :: HashMap Text Text -> EnvUsage
- requireCustomEnv :: HashMap Text Text -> EnvUsage

# Documentation

newtype MergedValue

Constructors

MergedValue |
Fields getMergedValue :: Value

Instances

Semigroup MergedValue |

applyCurrentEnv

Arguments

:: Bool | require an environment variable to be present?
-> Value |
-> IO Value |

getCurrentEnv :: IO (HashMap Text Text)

applyEnvValue

Arguments

:: Bool | require an environment variable to be present?
-> HashMap Text Text |
-> Value |
-> Value |

loadAppSettings

Arguments

:: FromJSON settings |
=> [FilePath] | run time config files to use, earlier files have precedence
-> [Value] | any other values to use, usually from compile time config. overridden by files
-> EnvUsage |
-> IO settings |

Load the settings from the following three sources:

- Run time config files
- Run time environment variables
- The default compile time config file

loadAppSettingsArgs

Arguments

:: FromJSON settings |
=> [Value] | any other values to use, usually from compile time config. overridden by files
-> EnvUsage | use environment variables
-> IO settings |

Same as `loadAppSettings`, but get the list of runtime config files from the command line arguments.

configSettingsYml :: FilePath

Location of the default config file.

getDevSettings :: Settings -> IO Settings

Helper for getApplicationDev in the scaffolding. Looks up PORT and DISPLAY_PORT and prints appropriate messages.

develMainHelper :: IO (Settings, Application) -> IO ()

Helper for develMain in the scaffolding.

makeYesodLogger :: LoggerSet -> IO Logger

data EnvUsage

ignoreEnv :: EnvUsage

useEnv :: EnvUsage

requireEnv :: EnvUsage

useCustomEnv :: HashMap Text Text -> EnvUsage

requireCustomEnv :: HashMap Text Text -> EnvUsage