Feedback when app-config.yaml is filtered at runtime
See original GitHub issueFeature Suggestion
Working on the frontend, I added a key to app-config.yaml
that was being filtered out when using a ConfigReader
to read it in my browser for apparently no reason. Having missing keys without any feedback, I asked for help and was told I needed to:
- Add a type definition for this key to
packages/app/config.d.ts
. - Add
@visibility frontend
in a comment directly above it.
While this is covered in the docs, I feel the developer experience could be improved by console.warn
ing or console.info
ing in a browser’s console when keys are being filtered out from a read app-config.yaml
with a link to relevant documentation and suggestions to adjust visibility then and there.
Possible Implementation
At the time of filtering out keys, add a console.warn
statement similar to
Key [key] is not marked as visible to the frontend, so it will be omitted from ConfigReader's output.
Please add `@visibility frontend` to your app's config.d.ts to adjust it.
More info: https://backstage.io/docs/conf/defining#visibility
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5 (5 by maintainers)
Top Results From Across the Web
What Is AWS AppConfig? - AWS AppConfig
AWS AppConfig, a capability of AWS Systems Manager, helps you manage, store, and safely deploy application configurations to your hosts at runtime.
Read more >Tutorial: Use dynamic configuration in an ASP.NET Core app
In the Filter by name box, enter the name of your resource group. In the result list, select the resource group name to...
Read more >App Builder Configuration Files - Adobe Developer
app.config.yaml is the main configuration file, defining the application's behavior and implementation. .env is used to store secrets and environment ...
Read more >App.Config: Basics and Best Practices - SubMain Blog
config file can contain more than that. Remember how a default app.config contained this: This is where we define which .NET runtime(s) the ......
Read more >app.yaml configuration file - Google Cloud
It is required to contain at least a runtime entry. Each service in your app has its own app.yaml file, which acts as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Since a looot of config keys will not be available on frontend, it might be too many console warnings for an average user of Backstage.
I was thinking that a console error or warning should be printed only when you run
config.get*
API in the frontend and if the key is missing visibility frontend.Quoting @freben
I think adding a warning/error when filtered config values are accessed in the frontend is a great idea, I might have a look at if I can get that in. Probably just do it for development mode though, as I wouldn’t want to bloat production builds with all of that extra information. Pretty much all of the confusion that we’ve seen is during development anyway, as in “why doesn’t this config value that I just added show up in the frontend?”
@joaomilho
The build doesn’t know what config values are being accessed, just like we can’t break the build if a certain global variable isn’t accessed at runtime. It’s actually one of the reasons the config schema exists, as it lets us break the build early when values are missing in config.
Yeah the mixing of frontend and backend config undeniably comes with its set of problems, just like mixing frontend and backend packages in the same repo. I do still think it’s worth it though, as the problem space has quite a big overlap with the problem of managing config from a bunch of different plugins. I see config schema as helping both problems, with the only extra addition needed to handle the mix being the config visibility, which we also use to filter secrets. I’m also quite happy with the security aspect of the existing solution, as it takes a conscious decision to make something available in the frontend.
The main contender of the current solution in my mind is to completely split frontend and backend schema and config, essentially having both
frontend-config.yaml
andbackend-config.yaml
, as well asfrontend-config.d.ts
andbackend-config.d.ts
. That’s the main thing I’m comparing to anyway, but please do add more ideas to the table if possible.You don’t need to use comments btw, you can use plain old JSON Schema if you want, it’s just not what most people prefer 😅
A big benefit of the current config system is that it’s possible to override values per deployment, allowing for example just the
app.baseUrl
to be tweaked for a preview build. That ofc is not possible if substitution happens at build time.