0

I'm building a static web app using React. Does Azure offer a service that allows one to embed a function into my Javascript code that loads a small value into clients' browsers. The values are not in the code, but controlled via the Azure UI.

That is, in the portal I'd create some configuration that states value = 1 and then I'd add Javascript code like if (azure_switch('app/value')) == '1' {...} to my app.

My goal is to have kill switch for portions of the App that could be controlled without pushing code changes. For my simple kill switch, I could build my own using app configurations and a new Azure function, but I'm curious if something like this already exists.

Also, if the function in the browser was context aware, it could also be used to control rollouts, or so that developers see a newer version of certain features.

RyeGrain
  • 61
  • 6

1 Answers1

0

Application settings: are available as environment variables to the backend API of a static web app.

https://learn.microsoft.com/en-us/azure/static-web-apps/application-settings

CSharpRocks
  • 6,791
  • 1
  • 21
  • 27
  • Thank you for the reply. I'm looking for code that can be placed into the React JavaScript. I can place `os.environ["TEST_VAR"]` into the Python code that support the API and it works fine. If I place`
    {process.env.TEST_VAR}
    ` into the React code that powers the static app, `TEST_VAR` isn't defined, which is also expected. Is there an way to use configurations to control the static app portion of the site without creating new Azure functions that export back-end configs? Before I created such functions, I wanted to know if Azure had any services I should investigate.
    – RyeGrain Nov 28 '21 at 22:18