Hiding private details from open source projects

后端 未结 4 2174
挽巷
挽巷 2021-02-11 07:22

I have a .net github project that is basically a wrapper around a web API. In the test project, I am calling to the API using an API key. I need to keep this key private, how do

4条回答
  •  暖寄归人
    2021-02-11 08:01

    One option is to use .config files instead of having secret keys hardcoded in sources.

    More info Using Settings in C# and step-by-step guide

    
       
          
       
    
    
    
    var secretKey = ConfigurationManager.AppSettings.Get("SecretKey");
    

提交回复
热议问题