Skip to content

Conversation

cprecioso
Copy link
Member

Extracts and refactors env variables based on #2796 (comment)

@cprecioso cprecioso requested a review from Martinsos July 4, 2025 12:46
@cprecioso cprecioso self-assigned this Jul 4, 2025
@Martinsos
Copy link
Member

All right @cprecioso! I will go to vacation in a day or so, so please have somebody else review it, I thikn @infomiho might be a good candidate. It might also benefit from fresh pair of eyes.

Copy link

cloudflare-workers-and-pages bot commented Jul 11, 2025

Deploying wasp-docs-on-main with  Cloudflare Pages  Cloudflare Pages

Latest commit: 396ec95
Status: ✅  Deploy successful!
Preview URL: https://11d62e4f.wasp-docs-on-main.pages.dev
Branch Preview URL: https://push-uuqynktmlxnr.wasp-docs-on-main.pages.dev

View logs

@infomiho infomiho self-requested a review July 16, 2025 15:50
Copy link
Contributor

@infomiho infomiho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some suggestions

where
changeExtensionTo ext = (++ '.' : ext) . fst . splitExtension

clientUrlFromServerEnvVarName :: String
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: clientUrlFromServerEnvVarName feels a bit off as a name because of the "from" (I understand that you wanted to say "from the perspective of") so I'd maybe go with just clientUrlEnvVarName since we have the context of this being in the server generator? And I see that you qualified the imports so it reads like Server.clientUrlEnvVarName.

Comment on lines 124 to 125
// Wasp requires that the url is set to the ${databaseUrlEnvVarNameText} environment variable.
url = env("${databaseUrlEnvVarNameText}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we can't provide the DATABASE_URL variable name in the other starters via Haskell, should we just keep it hard-coded here as well? I'm think for consistency sake and maybe some sort of search and replace in the future will put this place in the same results as other starters in the future.

[ "isAuthEnabled" .= isJust maybeAuth,
"clientUrlEnvVarName" .= Server.clientUrlFromServerEnvVarName,
"serverUrlEnvVarName" .= Server.serverUrlFromServerEnvVarName,
"jwtSecretEnvVarName" .= jwtSecretEnvVarName,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd either move jwtSecretEnvVarName to ServerGenerator.Common so we get nice context when using the env var name Server.jwtSecretEnvVarName or... if we believe that AuthG is a different context, maybe then better to import it using a qualified import so we get AuthG.jwtSecretEnvVarName.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left it as AuthG.jwtSecretEnvVarName

@cprecioso
Copy link
Member Author

@infomiho ready

@cprecioso cprecioso merged commit 9b3f33e into main Jul 17, 2025
7 checks passed
@cprecioso cprecioso deleted the push-uuqynktmlxnr branch July 17, 2025 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants