I am using ASP.NET Core 3.1 , Visual Studio 16.7.3 .
I have an API Key that needs to be used in my blazor wasm
app. However I don't want to place the value in appsettings.json
to make sure the API Key
doesn't get into my source control. One such way to achieve is to use secrets.json
in ASP.NET Core
. But the value from secrets.json
is not loading in my Program.cs
.
appsettings.json:
{
"APIKey": "appsettings.json"
}
Program.cs:
var builder = WebAssemblyHostBuilder.CreateDefault(args);
Debug.WriteLine($"APIKey:{builder.Configuration["APIKey"]}"); // works appsettings.json is logged in output window
If I move the key from appsettings.json
to secrets.json
secrets.json:
{
"APIKey": "secrets.json"
}
then output window log is empty. secrets.json
no longer works in blazor wasm
?