• Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login
FusionAuth
  • Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login

Parameterizing themes

Scheduled Pinned Locked Moved
Q&A
theme environments
0
2
2.8k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D
    dan
    last edited by 6 Oct 2021, 14:44

    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?

    --
    FusionAuth - Auth for devs, built by devs.
    https://fusionauth.io

    1 Reply Last reply Reply Quote 0
    • D
      dan
      last edited by 6 Oct 2021, 14:47

      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 using assign that can be used in other templates. You could use a templating language like jinja to build the Helpers 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).

      --
      FusionAuth - Auth for devs, built by devs.
      https://fusionauth.io

      1 Reply Last reply Reply Quote 0
      • D dan referenced this topic on 28 Nov 2021, 23:40
      • D dan referenced this topic on 8 Apr 2022, 21:39
      1 out of 2
      • First post
        1/2
        Last post