backstage / backstage

Backstage is an open framework for building developer portals
https://backstage.io/
Apache License 2.0
26.73k stars 5.52k forks source link

πŸš€ Feature: enable environment variables or appConfig.yaml properties to be referred to from template.yaml files. #24812

Open monkeyhandz opened 2 weeks ago

monkeyhandz commented 2 weeks ago

πŸ”– Feature description

In template.yaml I would like to be able to refer to variables that are in appConfig.yaml and/or an environment variable.

🎀 Context

I want to avoid hard coding values, especially api tokens and secrets, into template.yaml files.

✌️ Possible Implementation

Similar to template parameters, I was thinking the ${{ env.name }} and ${{ appConfig.name }} format, such as:

-  id: fetchAPISpec
    name: Fetch API yaml from SwaggerHub
    action: fetch:plain:file
    input:
        url: ${{ parameters.url }}
        targetPath: ${{ parameters.target }}
        token: ${{ env.MY_API_TOKEN }}

Or from appConfig:

-  id: fetchAPISpec
    name: Fetch API yaml from SwaggerHub
    action: fetch:plain:file
    input:
        url: ${{ parameters.url }}
        targetPath: ${{ parameters.target }}
        token: ${{ appConfig.myApiToken }}

An custom action is another possible solution, but I don't have details of how that would work. I raised this question on the support discord channel, and a user @drodil answered they had made their own action.

πŸ‘€ Have you spent some time to check if this feature request has been raised before?

🏒 Have you read the Code of Conduct?

Are you willing to submit PR?

No, but I'm happy to collaborate on a PR with someone else

benjdlambert commented 1 week ago

I think that this is probably most related to #9461