Search code examples
typescriptenvironment-variablesconfigbackstage

How to edit environment variables in Backstage.io?


I have a configuration in Backstage like below:

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

I'm quite new when it comes to configurations. Where do I edit AUTH_GITLAB_CLIENT_ID so I can add a value to it? I've seen a method where the values are passed in start up such as:

# starting in the root of your Backstage repo
» cd packages/backend
» env AUTH_GITHUB_CLIENT_ID=eafc816045b5533ba581 AUTH_GITHUB_CLIENT_SECRET=34922f6547991760e8f5219a529a9c00b0fd44ea yarn start

However, I don't want to manually set it up in every start up. I know that there should be a secrets file somewhere but I'm not really sure where to find it?

EDIT: Although creating a .sh file also works, I've chosen to just put all my keys in my app-config.local.yaml file and add it on my .gitignore file.


Solution

  • You can create your own startup.local.sh file and defined all variables you need in backstage. Also in my case we are using bash for running app locally, so we specified the path of this .sh file in .bashrc so that whenever we open terminal, those values will be available in current context of terminal. This way you will be having all your secrets in your code only and no longer need to add in code.

    Hope this helps !