turnage / graw

Golang Reddit API Wrapper
MIT License
288 stars 49 forks source link

Add function to load a bot from variables #74

Closed chand1012 closed 4 years ago

chand1012 commented 4 years ago

This change adds a small function to the file located in reddit/bot.go that simply allows users to load a bot via any variables they wish, allow for them to load it via any other file type they wish. For my personal use case, since I am running my application in a Docker container, I pass all API keys in via environment variables. This allows me to have the client ID and secret saved on my host and passed in as environment variables. I did not write a test as I do not believe this function warrants one, as the similar function do not have them either. I understand that you could just write the config yourself, but this method allows for a drop in replacement if needed.

CLAassistant commented 4 years ago

CLA assistant check
All committers have signed the CLA.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.07%) to 4.004% when pulling cd831f8603699bbd0f0f796aa24089e332ad0d83 on chand1012:master into 65715eea1cd0362b8e241cf50053175ca06508d2 on turnage:master.

turnage commented 4 years ago

I am not seeing the value of this change. This functionality is available through the method that receives a struct and that API is easier to evolve (when new fields are added, will we make a new method each time?).

I appreciate that you took the time to submit a pull request. Thank you for doing that! If you'll forgive me for offering advice mine is to propose a change before submitting a pull request that implements it. That ensures that your effort will be worthwhile and that it will not be duplicated by others.