Skip to content

Commit

Permalink
Merge pull request #228 from malteneuss/patch-1
Browse files Browse the repository at this point in the history
Add example on how to build Yaml Value in loadYamlSettings
  • Loading branch information
snoyberg authored Aug 15, 2024
2 parents d6e98c6 + 1dbf8fd commit 7380d7f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion yaml/src/Data/Yaml/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
-- In particular, merging environment variables with yaml values
--
-- 'loadYamlSettings' is a high-level API for loading YAML and merging environment variables.
-- A yaml value of @_env:ENV_VAR:default@ will lookup the environment variable @ENV_VAR@.
-- A yaml value of @_env:ENV_VAR:default@ or just @_env:ENV_VAR@ will lookup the environment variable @ENV_VAR@.
--
-- On a historical note, this code was taken directly from the yesod web framework's configuration module.
module Data.Yaml.Config
Expand Down Expand Up @@ -185,6 +185,11 @@ requireCustomEnv = RequireCustomEnv
--
-- > loadYamlSettings ["config/foo.yaml"] [] useEnv
--
-- Alternatively you can configure settings through the Yaml @Value@ directly in Haskell.
-- For example, to load up settings from only from environment variables, you can use:
--
-- > loadYamlSettings [] [object ["connectionString" .= ("_env:DATABASE_URL" :: String)]] requireEnv
--
-- @since 0.8.16
loadYamlSettings
:: FromJSON settings
Expand Down

0 comments on commit 7380d7f

Please sign in to comment.