Skip to content

Instantly share code, notes, and snippets.

@abierhaus
Created March 11, 2021 08:35
Show Gist options
  • Select an option

  • Save abierhaus/59eb35135c840c8c583dc5fb16eea719 to your computer and use it in GitHub Desktop.

Select an option

Save abierhaus/59eb35135c840c8c583dc5fb16eea719 to your computer and use it in GitHub Desktop.
Use Secrets
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment()) app.UseDeveloperExceptionPage();
app.UseRouting();
//Get User Secrets here
var username = Configuration["YourService:Username"];
var password = Configuration["YourService:Password"];
app.UseEndpoints(endpoints =>
{
endpoints.MapGet("/",
async context =>
{
await context.Response.WriteAsync(
$"Hello. Your successful setup your user secrets. Your username is '{username}'");
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment