Reputation: 1
in a WebApp project, I need the static files in App.razor, including the Blazor startup section:
<link href="https://EP-custom-cdn.azurefd.net/main.css" rel="stylesheet" />
<script src="_framework/blazor.web.js" autostart="false"></script>
<script>
Blazor.start({
webAssembly: {
loadBootResource: function (type, name, defaultUri, integrity) {
console.log('Loading:', type, name, defaultUri, integrity);
switch (type) {
case 'dotnetjs':
case 'dotnetwasm':
case 'timezonedata':
case 'assembly':
return `https://EP-custom-cdn.azurefd.net/_framework/${name}`;
}
}
}
});
</script>
I want the CDN URL to be configurable via an environment variable in appsettings.json for production purposes because we have QA, PRE, and PROD environments. Additionally, it should be compatible with debugging.
What is the correct way to configure the download of Blazor static files from a CDN in a parameterizable way, considering that the .wasm files are different in each environment due to different application versions and should point to a different container in the CDN?
How can this be done?
Thanks
Configure in the App.razor
file of the web app project so that the CDN path varies by environment based on an environment variable in appsettings.json
or by directly retrieving the path value from a variable in that file.
Upvotes: 0
Views: 15