Closed onlinejudge95 closed 5 years ago
Hi @onlinejudge95 Thanks for stopping by and creating a detailed issue 🙏🏻 You have to first add your API key in config.py. For your ref: https://github.com/vaibhavsingh97/random-word/blob/master/README.md#development
The encrypted API key committed in VCS is for Travis to pass the tests
Is your feature request related to a problem? Please describe. The API key, used in the module is coming from an encrypted config file, would it not be a better idea to take this configuration value away from a file that is committed in VCS. It can also be helpful as it won't allow the possibility of someone finding that encryption and (if possible) breaking it to gain the API key (which i believe is yours). Point of this feature request being giving the end user (developer or the consumer) the ability to allow them to use their own API key without forking this repo and changing the code here.
Describe the solution you'd like A quick solution that delegates the SECRET management away from this module would be to store the API key in the environment in which it is hosted and then at the time of usage simply do something like
API_KEY = os.environ.get('API_KEY')
It would allow the Secrets to stay out of VCS where they can be altered (not easily though) by someone. Also, In this manner as a side effect it would be easy for developers to use their own API keys. Again if we consider the case that the underlying APIs decide to implement RateLimiting for API Calls, it would not be a good idea to distribute your module with your API key.Describe alternatives you've considered One more alternative i can think of is that right at the time of Instantiation we can pass the API key directly as a param in the constructor or give a path to a config file (in
json
,ini
oryaml
format, whichever suits best)obj = RandomWords(api_key=os.environ.get('API_KEY'))
orobj = RandomWords(config='/path/to/config.file')
Additional context This feature request is based upon the 12 Factor application paradigm.
I would be more than willing to work on this feature request, if it is decided to work upon.