Skip to content

Conversation

dylansm
Copy link

@dylansm dylansm commented Feb 12, 2016

This prevents the need for another token file.

@ConradIrwin
Copy link
Collaborator

Hey @dylansm, are any other tools using this convention?

@dylansm
Copy link
Author

dylansm commented Feb 12, 2016

In terms of Github tools that use this particular variable name? None that I know of. But Rails, AWS gem and many more tools make use of environment variables as an alternative to writing to files that might inadvertently be committed to a repository, e.g.

@ConradIrwin
Copy link
Collaborator

Ok, my biggest concern is that this makes the code/interface more complicated, and I don't understand the user-benefit (it's not like people are likely to have this environment variable set, and so we can just "automatically work" for a large number of users).

You need to have the token on disk somewhere (whether it's in ~/.zshrc or .env or ~/.gist), so it doesn't really make a different which file it is in (as far as I can tell).

Can you expand a bit on your actual use-case here? Otherwise I don't think it's worth the overhead

@dylansm
Copy link
Author

dylansm commented Feb 13, 2016

Having the choice to use an environment variable seems to me to be less invasive (for users) than creating a new dotfile. I prefer to keep my keys and secrets in a single file to spreading them all over my user directory.

@cweagans
Copy link

^ same. I keep secrets in one file for simplicity, and those secrets are generally environment variables. IMO, it really doesn't add that much overhead (technical or otherwise).

end

def self.read_token_or_fetch_from_env
ENV['GITHUB_AUTH_TOKEN'] || self.read rescue nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable name should be namespaced somehow to prevent conflicts. For instance, GIST_GITHUB_API_TOKEN or something.

infinisil added a commit to infinisil/system that referenced this pull request Feb 10, 2018
This reverts commit 07a714b. I thought defunkt/gist#232 was merged, but that is not the case
@kenorb
Copy link

kenorb commented Jul 11, 2018

My use case is to load the token from the variable instead of the file, so I can use with Travis CI where I can encrypt the variable or pass it as a secret variable, otherwise, the file needs to be part of the repository, therefore visible for all.

Another use case when used with Docker, it's safer to pass the key as the variable during the run, instead of keeping it as a file inside the container for other people to access.

@kenorb
Copy link

kenorb commented Jul 11, 2018

One-liner to patch the installed gist gem:

patch -d "$(gem env gemdir)"/gems/gist-* -p1 < <(curl -s https://github.com/defunkt/gist/commit/5843e9827f529cba020d08ac764d70c8db8fbd71.patch) 

Tested PR and it works as expected. Although a better variable as suggested would be nice.

@mrusme
Copy link

mrusme commented Mar 2, 2019

Could we stick with GITHUB_TOKEN? It seems to be what @github uses and I came across it in various client projects as well. See here.

@ConradIrwin
Copy link
Collaborator

Closing as too much time has passed, I'm still open to this change using GITHUB_TOKEN for compatibiltiy with other tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants