Parameterizing themes
-
Do you have any pointers for passing environment variables (or maybe arbitrary, application settings) into the theme templates?
What I’m aiming for is an elegant solution for parameterizing static asset host information – so something like this, ideally:
<link rel="stylesheet" href="${STATIC_ASSET_HOST}/styles.css"/>
where STATIC_ASSET_HOST is dev.example.com for dev, qa.example.com for qa, and so on.
This could work, if using an application setting:
[#if is_dev] <link rel="stylesheet" href="http://localhost/styles.css"/> [#else] <link rel="stylesheet" href="http://s3.example.com/styles.css"/> [/#if]
Any pointers?
-
We don’t currently resolve any environment variables in the themes, or anything other than what is documented here: https://fusionauth.io/docs/v1/tech/themes/template-variables/
But you can set variables in the
Helpers
template usingassign
that can be used in other templates. You could use a templating language like jinja to build theHelpers
template at build time and then a script to load it during deploy. (Or even sed.)You can also create different themes (a dev theme, a qa theme) and assign them via scripts to the different environments (unsure if you are using different tenants to represent environments or different FusionAuth instances, but the concept is the same).
-
-