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

Yesod.Config

Synopsis

Documentation

data AppConfig e Source

Dynamic per-environment configuration which can be loaded at run-time negating the need to recompile between environments.

Constructors

AppConfig 

Fields

appEnv :: e
 
appPort :: Int
 
appRoot :: Text
 

Instances

Show e => Show (AppConfig e) 

loadConfig :: Show e => e -> IO (AppConfig e)Source

Load an AppConfig from config/settings.yml.

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.

withYamlEnvironmentSource

Arguments

:: 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.