clj-codes / docs.frontend

Frontend SPA for docs.clj.codes
https://docs.clj.codes/
The Unlicense
4 stars 0 forks source link

feat: env vars for production configs #40

Closed kdmoreira closed 6 months ago

kdmoreira commented 6 months ago

This PR allows configuration settings in non-debug mode to be set as environment variables. It employs the goog-define macro to set the default production values at compile time, thereby maintaining the current behavior. Additionally, it introduces the #shadow/env tag in shadow-cljs.edn, which enables these values to be overwritten by environment variables.

rafaeldelboni commented 6 months ago

Looks good to me, just one question.

The main reason of this change is to be able to dynamically switch those variables at compile time right?

Could you point this functionality in the readme? There is an small session describing the config, I think is worth mentioning the new feature.

kdmoreira commented 6 months ago

Yes, @rafaeldelboni , that was the main reason. I wanted a way to overwrite the default configs if their corresponding environment variables were present. I did it based on this information in shadow-cljs' docs: Using Environment Variables. This other section introduced me to the goog-define macro and how the :closure-defines config works: Closure Defines

Sure. I've just updated the README with this feature and added these links.