User Secrets in Blazor Web Assembly
I have a Blazor Web Assembly app that can connect to a production API on the web or a development API on the local machine. The Program.cs file looks like this:
Whenever I want to switch between the two, I have to edit the file, and sometimes I forgot I need to undo the change before checking in.
My question is: Is it possible to use User Secrets to make this easy switch while I'm testing? I can already to that in other code bases, but since this is Web Assembly and doesn't have AppSettings, I'm not sure how to do it here.
Thank you for your help.
3 Replies
Heading to bed, I'll respond to any inquiries in the morning. Thank you
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
I don't have an appsettings file in my blazor project, but you think I can just add it and it should work? I'll give it a try, thank you!
I'm using a client generated by nswagstudio, so that's why it's slightly different
Oh I see what you mean. It should already have created a new instance of Client. Okay, I'll take a look at that too