Best practice environment variables

We found out that this might work:

  • create an OPTIONSET with 2 options: [stg] [live]
  • Header Page:
    • Workflow page-load → onlyif(isntlive==True) → Set State Header = [stg]
    • Workflow page-load → onlyif(isntlive==False) → Set State Header = [live]

This works. We were wondering if this is best practice, since there might be scenarios that you do NOT have access to the Header element in a certain situation.

Why an option set? Why a workflow on load?

Why not just a conditional on the header or what have you. If you insist on a state at the most make a boolean isLive but there’s really no point as its the same as IF isntlive==true.

actually, we have multiple environment variables per live/stg. Therefore we created the two options [live] and [stage] and each of them has multiple attributes such as:

  • external-api1-url
  • external-api2-url
  • version
  • domain

We found that setting this option in the header element works for us

Sure it works but you called the subject Best Practices and just because an approach is not performant doesnt mean it wont work.

Domain and version should be dynamic and storing api urls in option set is not a good idea.

1 Like