How To Store Secrets For Local Development

Поделиться
HTML-код
  • Опубликовано: 8 фев 2025
  • 💻Watch the full tutorial: • ASP.NET Core Tutorial ...
    Are you storing your connection strings or secret keys in your appsettings.json file? Are you aware of the dangers of doing this? Is there a better way?
    In this video I explain how to use .NET’s Secret Manager to safely store your application secrets during local development.
    🔥Become a Senior C# Backend Engineer: juliocasal.com...
    🗺️Get My Free .NET Backend Developer Roadmap: juliocasal.com...
    Join me on Patreon: / juliocasal
    Follow me on LinkedIn: / juliocasal
    Follow me on X: x.com/julioc
    #csharp #dotnet #aspnetcore

Комментарии • 12

  • @darkmift
    @darkmift Год назад +1

    Quality Content mate,thank you

  • @jeandyenriquerodriguezdiaz3984
    @jeandyenriquerodriguezdiaz3984 5 месяцев назад +1

    Thanks a lot for this video, it is very helpful. I would like to know how we can set a similar configuration but using an azure key vault with a MongoDB database.

  • @orturjamen9689
    @orturjamen9689 Год назад +4

    But secret manager work on stage and production environments?

    • @juliocasal
      @juliocasal  Год назад +4

      No, this is just for your local dev box. For anything beyond that you want to use a secure cloud location like Azure Key Vault.

    • @orturjamen9689
      @orturjamen9689 Год назад +2

      @@juliocasal so if i want to use secret manager but with the option to control the db connection string (sometime i will want to work against stage and not local) so how can i achieve this?

    • @MrBestard
      @MrBestard Год назад

      ​@orturjamen9689 option 1 change the connection string to stage db in current secretmanager json.
      Option 2, create another copy of secret manager json with a different guid, change the db connection string.

  • @divyaJk123
    @divyaJk123 10 месяцев назад +1

    Can i use secrets. json values in bdd test cases? Like clientid and client secrets?

    • @juliocasal
      @juliocasal  10 месяцев назад +1

      You should not, it's not meant for that.

  • @orney21d
    @orney21d Год назад

    Great content ! I’m wondering how to use it if we use in the ASPNET_CORE Env variable instead of “Development” , “Local” , or something else , I have been in those scenarios and the secret manager doesn’t work in those cases. Recommendation here ??

    • @juliocasal
      @juliocasal  Год назад +1

      Orney, you should be able to call AddUserSecrets youself, instead of letting WebApplication.CreateBuilder() call it for you (which happens only in "Development" environment). Like this:
      builder.Configuration.AddUserSecrets();