fugue / credstash

A little utility for managing credentials in the cloud
Apache License 2.0
2.06k stars 214 forks source link

feature request - file input #79

Closed ozbillwang closed 7 years ago

ozbillwang commented 8 years ago

I knew @ can be used to input the file as value. But it looks weird.

And how to deal with a value start with @

credstash put my-github-password @secure123
usage: credstash put [-h] [-k KEY] [-v VERSION] [-a]
                     credential value [context [context ...]]
credstash put: error: argument value: Unable to read file secure123

Can we have an option such as -f, so we can input the file as:

credstash put my-github-password -f password.file 
ozbillwang commented 8 years ago

and can we have auto-version (-a option) as default option?

This also looks weird.

$ credstash list
my-github-password -- version 0000000000000000001
my-github-password -- version 0000000000000000003   # run with -a
my-github-password -- version 2      # run with -v 2
alex-luminal commented 8 years ago

The DDB field that holds the item version is a string. This is great, because it means you can chose whatever versioning scheme you want. So, if you want to use natural numbers, you can, but you can also have versions like 2016-01-01. The downside to storing versions as strings is it means that the sort order goes to pot when you get past 9 versions of a key. The lexicographic sort order of 11 key versions might be:

foo - 1
foo - 10
foo - 11
foo - 2
foo - 3
 ... etc

So, we left-pad the version if you use -a. If you want to chose some other versioning scheme, you do that instead.

alex-luminal commented 8 years ago

-f for file sounds like a totally reasonable thing to do. We need to keep @ as well, so as to not break anyone who has written automation with it. We should figure out how to cope with values that start with @.

ozbillwang commented 7 years ago

Seems -f has been used as --format, to avoid inconsistently, I think this feature is not required anymore.

  -f {json,yaml,csv}, --format {json,yaml,csv}