environment-variablesbackstage

How to properly pass environment variables for local development in Backstage.io


I have setup my app-config.yaml to use environment variable substitution (EVS) like bellow:

auth:
  environment: development
  providers:
    gitlab:
      development:
        clientId: ${AUTH_GITLAB_CLIENT_ID}
        clientSecret: ${AUTH_GITLAB_CLIENT_SECRET}

And this works fine when deployed though my CI/CD pipeline. but for local development I have not found a good way to inject environment variables.

I do have an app-config.local.yaml but I would like to avoid having essentially having two copies of `app-config.yaml, one with hardcoded values and the other with the EVS.

What is the best way to load environment variables so that app-config.yaml can read them.

This is a very similar question to How to edit environment variables in Backstage.io? But the question asker never gave an example of how they are actually adding it into their app-config.local.yaml file


Solution

  • tl;dr: I used a .env.yarn file

    https://stackoverflow.com/a/77950324/6010125