<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Barrett Stolzman</title>
    <description>The latest articles on DEV Community by Barrett Stolzman (@bigmacstack).</description>
    <link>https://dev.to/bigmacstack</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1272649%2F83266cae-c212-422b-8f82-57228323f5cc.png</url>
      <title>DEV Community: Barrett Stolzman</title>
      <link>https://dev.to/bigmacstack</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bigmacstack"/>
    <language>en</language>
    <item>
      <title>Stop modifying your appsettings for local development. (please)</title>
      <dc:creator>Barrett Stolzman</dc:creator>
      <pubDate>Thu, 22 May 2025 03:03:52 +0000</pubDate>
      <link>https://dev.to/bigmacstack/stop-modifying-your-appsettings-for-local-development-please-2h4n</link>
      <guid>https://dev.to/bigmacstack/stop-modifying-your-appsettings-for-local-development-please-2h4n</guid>
      <description>&lt;h1&gt;
  
  
  Intro
&lt;/h1&gt;

&lt;p&gt;Modern .NET applications offer a convenient default configuration pipeline, but many teams struggle with its intricacies. A common problem arises when using &lt;code&gt;appsettings.json\&lt;/code&gt; for configuration: developers often modify it with local development settings and inadvertently commit these changes to version control. This can lead to unintended consequences, such as accidentally enabling verbose logging in production or, more seriously, exposing sensitive information like API keys, requiring cleanup of the Git history. It's crucial to understand the configuration pipeline to avoid these pitfalls.&lt;/p&gt;

&lt;h1&gt;
  
  
  TLDR
&lt;/h1&gt;

&lt;p&gt;Avoid modifying &lt;code&gt;appsettings.json\&lt;/code&gt; for local development to prevent accidentally committing changes to version control. Instead, use .NET User Secrets. Initialize User Secrets via CLI (&lt;code&gt;dotnet user-secrets init\&lt;/code&gt;) or IDE tools. Secrets are stored in a &lt;code&gt;secrets.json\&lt;/code&gt; file in a user-specific directory. Manage secrets using CLI (&lt;code&gt;set\&lt;/code&gt;, &lt;code&gt;remove\&lt;/code&gt;, &lt;code&gt;clear\&lt;/code&gt;, &lt;code&gt;list\&lt;/code&gt;) or by directly editing &lt;code&gt;secrets.json\&lt;/code&gt;. This keeps local configurations separate and prevents issues in production.&lt;/p&gt;

&lt;h1&gt;
  
  
  So what should I do?
&lt;/h1&gt;

&lt;p&gt;You may say, “But my team has always done it this way, and now you’re telling me to stop. What the heck am I supposed to do?.”&lt;/p&gt;

&lt;p&gt;Good question - .NET User Secrets is the answer.&lt;/p&gt;

&lt;p&gt;By default, when the .NET environment is set to development the pipeline will pull in and prioritize a special sort of appsettings file defined by a GUID in your project file. The GUID and corresponding secrets.json file gets created when you request to edit it from your IDE.&lt;/p&gt;

&lt;h2&gt;
  
  
  Important note
&lt;/h2&gt;

&lt;p&gt;Its important to note that user secrets management is specifically designed for local development and not production. The pipeline does its best to prevent this by only using this method of configuration when the proper environment variables are present, but there are ways around it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Initializing user secrets in your project:
&lt;/h3&gt;

&lt;h4&gt;
  
  
  .NET CLI
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet user-secrets init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Jetbrains Rider
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ficzeg6x7cf9jdrw59jbx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ficzeg6x7cf9jdrw59jbx.png" alt="Jetbrains Rider" width="615" height="843"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Right click project &amp;gt; Tools &amp;gt; .NET User Secrets&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  VSCode (w/ C# Dev Kit)
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fay49fgywm3bbflpbwq78.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fay49fgywm3bbflpbwq78.png" alt="VSCode" width="502" height="309"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Right click project &amp;gt; Manage User Secrets&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Visual Studio
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7y8fnwyz3lol37vvy9z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7y8fnwyz3lol37vvy9z.png" alt="Visual Studio" width="334" height="628"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Right click project &amp;gt; Manage User Secrets&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What happens after initialization?
&lt;/h3&gt;

&lt;p&gt;If you open your .csproj file after initializing user secrets, you will notice some new info:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ify6ttvlb1hsftgb7s7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ify6ttvlb1hsftgb7s7.png" alt="Csproj Example" width="800" height="216"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This GUID value corresponds to a directory containing a single file called secrets.json buried in your user level application data directories.&lt;/p&gt;

&lt;h4&gt;
  
  
  Windows
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;%APPDATA%\Microsoft\UserSecrets\&amp;lt;user_secrets_id&amp;gt;\secrets.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Linux/Mac
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/.microsoft/usersecrets/&amp;lt;user_secrets_id&amp;gt;/secrets.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can think of this file as a local version of the appsettings.json file that will override any values defined in your project’s baseline appsettings.json file. This allows you to have your own personal configuration without affecting the baseline configuration for the rest of your team.&lt;/p&gt;

&lt;h3&gt;
  
  
  Managing secrets:
&lt;/h3&gt;

&lt;p&gt;If you’re a visual person and prefer just editing the file, your IDE will open the file for you using one of the methods defined above depending on your IDE. From there you can just edit everything like you would the normal appsettings file.&lt;/p&gt;

&lt;p&gt;If your preferred method of doing things in your .NET projects is via the CLI tooling, managing the values in your secrets file is pretty straightforward.&lt;/p&gt;

&lt;h4&gt;
  
  
  Setting a secret
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet user-secrets &lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="s2"&gt;"ExistingKeyName"&lt;/span&gt; &lt;span class="s2"&gt;"LocalEnvValue"&lt;/span&gt;

// or &lt;span class="k"&gt;for &lt;/span&gt;nested config objects

dotnet user-secrets &lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="s2"&gt;"ExistingKeyParent:NestedKey"&lt;/span&gt; &lt;span class="s2"&gt;"LocalEnvValue"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Removing a secret
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet user-secrets remove &lt;span class="s2"&gt;"KeyToRemove"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Removing all of the secrets
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet user-secrets clear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Listing all of the secrets
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet user-secrets list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;This is not the only option you have in the spirit of not modifying the baseline appsettings file for local development, but I feel that it's a great one and easy to adopt into your development workflow. This post is by no means supposed to be an exhaustive explanation of this feature, feel free to dive deeper into the msdn documentation here (&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets&lt;/a&gt;)&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>aspdotnet</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Looking for Honest Feedback</title>
      <dc:creator>Barrett Stolzman</dc:creator>
      <pubDate>Mon, 12 Feb 2024 22:58:42 +0000</pubDate>
      <link>https://dev.to/bigmacstack/looking-for-honest-feedback-oe2</link>
      <guid>https://dev.to/bigmacstack/looking-for-honest-feedback-oe2</guid>
      <description>&lt;p&gt;Hey guys, recently started trying to branch out of the corporate world by launching a company. I've been an engineer for over a decade now, but most of my experience these past few years has been server side. I tried building our company site using a site builder, but it just didn't feel right. My primary skills don't reside with the frontend side of things, but I can still get it done. With that said, Im working to get back up to speed with where things are headed right now!&lt;/p&gt;

&lt;p&gt;Im not trying to sell anything (would be kind of weird to sell consulting services to my own kind lol), just looking for genuine feedback on the design and feel of the new site I just put up for my company. Any feedback would be appreciated 😊&lt;/p&gt;

&lt;p&gt;&lt;a href="https://progenixsoftware.com/"&gt;Progenix Software&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>saas</category>
      <category>feedback</category>
    </item>
  </channel>
</rss>
