Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up runtime environment variables #203

Closed
4 tasks done
Tracked by #36
raix opened this issue Nov 11, 2023 · 0 comments · Fixed by #204
Closed
4 tasks done
Tracked by #36

Set up runtime environment variables #203

raix opened this issue Nov 11, 2023 · 0 comments · Fixed by #204
Assignees
Labels
enhancement New feature or request

Comments

@raix
Copy link
Contributor

raix commented Nov 11, 2023

To setup Application Insights, CDN url, cluster, region details and more in the web client we need to enable runtime environment variables.

Build environment variables are set when creating the static bundle files, these cannot be changed. Examples of these could be related to version and build related configurations. BUILD_ENV

Runtime environment variables are dynamic, they can be changed and updated by developer operations and relate to deployment specific settings. RUNTIME_ENV

To ensure that it's clear for everyone which custom runtime environment variables are sent to the client they will be suffixed with PUBLIC_ and filtered by this.

These runtime environment variables are not prefixed as they are added by the platform setup:

  • PUBLIC_URL - location of the served index.html / base url
  • CDN_URL - location of client bundle files
  • CLUSTER_ID?
  • REGION?

Solution options:

  • Have an endpoint to return the runtime environment variables
    • Extra roundtrip / latency - Async / complexity
  • Inject global variable in script tag

Solution:

  • Add runtime environment in meta tag
    This solution will prevent extra roundtrips and should not violate CSP

Developer ergonomics:

  • To get an environment variable: const foo = environment.get("PUBLIC_FOO");

Tasks

@raix raix self-assigned this Nov 11, 2023
@raix raix added the enhancement New feature or request label Nov 11, 2023
@raix raix added this to the 🐣 PlatformPlatform Alpha milestone Nov 11, 2023
@raix raix linked a pull request Nov 11, 2023 that will close this issue
3 tasks
@tjementum tjementum removed this from the 🐣 PlatformPlatform Alpha milestone Jan 22, 2024
@tjementum tjementum changed the title Setup runtime environment variables Set up runtime environment variables Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
2 participants