on master help sign in
Add example on how to build Yaml Value in loadYamlSettings
commit1dbf8fdf450f412f6d7ee688ad248a62d5d992f8 authormalteneuss <malteneuss@users.noreply.github.com> dateWed 14 Aug 2024, 23:01 (2 years ago) parentd6e98c6
1 file changed+6−1
yaml/src/Data/Yaml/Config.hs+6−1
yaml/src/Data/Yaml/Config.hs+6−1
@@ -5,7 +5,7 @@
55-- In particular, merging environment variables with yaml values
66--
77-- 'loadYamlSettings' is a high-level API for loading YAML and merging environment variables.
8−-- A yaml value of @_env:ENV_VAR:default@ will lookup the environment variable @ENV_VAR@.
8+-- A yaml value of @_env:ENV_VAR:default@ or just @_env:ENV_VAR@ will lookup the environment variable @ENV_VAR@.
99--
1010-- On a historical note, this code was taken directly from the yesod web framework's configuration module.
1111module Data.Yaml.Config
@@ -185,6 +185,11 @@ requireCustomEnv = RequireCustomEnv
185185--
186186-- > loadYamlSettings ["config/foo.yaml"] [] useEnv
187187--
188+-- Alternatively you can configure settings through the Yaml @Value@ directly in Haskell.
189+-- For example, to load up settings from only from environment variables, you can use:
190+--
191+-- > loadYamlSettings [] [object ["connectionString" .= ("_env:DATABASE_URL" :: String)]] requireEnv
192+--
188193-- @since 0.8.16
189194loadYamlSettings
190195 :: FromJSON settings