aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Build time environment variables in Blazor wasm

Open ziaulhasanhamim opened this issue 3 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

In Blazor wasm the only way to have configurations in www-root appsettings. But there is a good need for build time environment variables for CI/CD usage.

Describe the solution you'd like

In vue there is a very neat and easy solution to this environment variables. The variables are embedded into the code in build time in vue. In blazor can't there be an option to inject variables into configurations at build time?

Additional context

No response

ziaulhasanhamim avatar Nov 20 '22 17:11 ziaulhasanhamim

Thanks for contacting us.

We're moving this issue to the .NET 8 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

ghost avatar Nov 21 '22 14:11 ghost

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

ghost avatar Nov 23 '22 18:11 ghost

I'm not sure this is what @ziaulhasanhamim had in mind, but I would like to see Blazor publish merge appsettings.json, appsettings.dev.json and output a single appsettings.json file. Currently, I'm doing a hacky workaround to delete the file in my build pipeline and then copy a separate file to the wwwroot folder during the deploy pipeline before it's deployed to a static site.

This means that I have to have complete settings in both files, unlike other dotnet solutions. I don't want to ship my local or development settings to prod.

Eonasdan avatar Apr 06 '23 15:04 Eonasdan

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

ghost avatar Dec 21 '23 18:12 ghost

For anyone who finds this issue I have created a GitHub Action that does what @Eonasdan describes in this comment.

I'm not sure this is what @ziaulhasanhamim had in mind, but I would like to see Blazor publish merge appsettings.json, appsettings.dev.json and output a single appsettings.json file. Currently, I'm doing a hacky workaround to delete the file in my build pipeline and then copy a separate file to the wwwroot folder during the deploy pipeline before it's deployed to a static site.

This means that I have to have complete settings in both files, unlike other dotnet solutions. I don't want to ship my local or development settings to prod.

You can find the details in the repository: https://github.com/Afterlife-Guide/AppSettings.Merge

baynezy avatar Feb 07 '24 07:02 baynezy