From b50a1857e0bbcce4949e8a7a8fcd7117bf302c21 Mon Sep 17 00:00:00 2001 From: Amitai Burstein Date: Wed, 24 Jul 2024 15:29:22 +0300 Subject: [PATCH] Improve docs on Using Custom Config Parameters --- Guide/config.markdown | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Guide/config.markdown b/Guide/config.markdown index a097bbcf6..b794d09a5 100644 --- a/Guide/config.markdown +++ b/Guide/config.markdown @@ -55,14 +55,18 @@ If you are ok to commit your secrets to git repo, you can also put the env vars You can now access the `StripePublicKey` parameter by calling `getAppConfig @Config.StripePublicKey`: ```haskell -import qualified Config - action MyAction = do let (StripePublicKey stripePublicKey) = getAppConfig @Config.StripePublicKey putStrLn ("Stripe public key: " <> stripePublicKey) ``` +If you want to fetch it in a helper function, we need to define the `?context`: + +```haskell +getStripePublicKey :: (?context :: ControllerContext) => StripePublicKey +getStripePublicKey = getAppConfig @Config.StripePublicKey +``` ## Environment Variables