-
Notifications
You must be signed in to change notification settings - Fork 12
Allow setting tokens via env variables #13
Comments
Some way to say "look at this envvar" from the config file would be a good way to do this. I guess making the password be something like:
This would also be possible:
Guidance from rust-lang/rfcs#2730 would be useful to know how to interpret the |
I'm not fond of changing the configuration file just to get tokens from environment variables because it seems like a very narrow use case. It also encourages sharing the same token with multiple applications which is not ideal. However the So setting a token could be done in a couple of ways: # Token stored in the configuration file
token = "mytoken"
# Token stored in an environment variable
token-from-process = ["bash", "-c", "echo $MY_API_TOKEN"]
# Generic case: token returned by calling `executable arg1 arg2 ...`
token-from-process = ["executable", "arg1", "arg2"] As mentioned in the RFC the process inherits |
This is the exact use case I have. I don't want to generate 15 tokens for GitHub but have on per machine and share it with all my programs and using ENVs for something is not narrow. Basically any program which wants an API Token of some sort uses the ENV Also I don't really see the need to store an API token which has the scope of showing publicly available information in a password manager. |
Why would you need a token per project for |
I made the changes for this feature on the following branch: https://github.com/nbedos/cistern/tree/feature/token_from_process Usage is detailed in the sample configuration file: # Also, every "token" key can be replaced by "token-from-process" which is a list of strings
# consisting of the name of an executable to call followed by the arguments to be provided to it.
# The process will inherit stdin and stderr (allowing for password prompts) and the output of the
# process will be used as the value of the token.
#
# Examples:
# # Read token from environment variable
# token-from-process = ["bash", "-c", "echo $MY_API_TOKEN"]
#
# # Read token from `pass` store
# token-from-process = ["pass", "ci/gitlab/cistern"]
# I tested this with pass and the workflow is quite nice. You get a single password prompt and then @SuperSandro2000 Let me know what you think. |
Single password prompt even for multiple tokens? I still kinda prefer getting environment variables directly. |
Well you can do that by setting
|
This only works if I have the tokens in my startup script and is kinda a workaround. |
This should be fixed by a4392aa
Yeah but then I have to implement, test and document both I understand the syntax is not ideal but it provides the functionality you requested and I don't see any other drawback. And given how it's implemented it will also work for other people storing their credentials elsewhere meaning it's unlikely I'll have to extend this feature later. |
So right now we are both lazy and don't want to do something. I mean it should be fine. Thanks 👍 |
Just stop contributing to this repository. I'm sure you can find other repositories and developers that are up to your standards. |
I already have a lot of tokens in my ENV variables and would like to re-use them.
The text was updated successfully, but these errors were encountered: