In .NET 8, Blazor projects now have a way to pass additional configuration options to the runtime, including setting environment variables before Mono starts.
The way to do it depends on whether you're using a blazorwasm template, or the new blazor (unified Server/Client project)
If you created a blazorwasm project from the default template, in wwwroot/index.html replace this: