Hiding private details from open source projects

后端 未结 4 2173
挽巷
挽巷 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:19

    You are probably looking for the App.config file for a project. It will be copied to .exe.config when you compile it. Users can edit that config file as needed.

    In that config file, you can add your API keys:

    
        
            
        
    
    

    Then you can access it from your code using ConfigurationManager.AppSettings:

    string apiKey = ConfigurationManager.AppSettings["APIKey"];
    

提交回复
热议问题