p-ranav/saveddit

Move client IDs and secrets in a separate configuration file

NickolaiBeloguzov opened this issue · 2 comments

Main issue:
In your script files you store your client IDs and secrets as constants. This can pose a number of problems.

Main problems:

  • Sensetiva Data exposure. Client IDs and secrets are considered rather sensetiva data. Storing them as constans is highly discouraged as basically anyone can get a hold of them.
  • Difficult configuration. If you need to change/update your tokens, this can be complicated for the end user due to the fact that he needs to change it in the script files itself, which is rather discouraging.
  • Code redundancy. You define your credentials twice, thus making it harder to change it (you need to go to every file and manually update them, which is inefficient at best) and also you end up with basically the same variables, which is also inefficient.

Solution:
Move all this data in a separate configuration file (.yaml or .json) and create a function to parse it. That way you can store all your data in one place and retrieving it via a simple function call, thus making the process of updating it much more simpler, your code is now optimized (a bit, but still), and any end user feels more comfortable working with configuration file than with raw codebase.

If you do not mind, assign me please for this issue.

Thanks for this awesome project!

Config file solution works for me.

Since the script is written to run from the root of the repo, I'd add a configs directory and store such configuration files.

The usage would then become:

python3 -m saveddit.saveddit -c configs/foo.json -r aww -f hot -l 15

Thanks for the idea, but I don't really see why I would ever need multiple configs (correct me here if I'm wrong), so my addition just creates a .yaml file in the root of a repo and uses it. anyway I've already created a #4 pull request with more info in its description, but I'm always able to correct it