added env variable
This commit is contained in:
parent
05a68df896
commit
1d5d900f26
2 changed files with 20 additions and 7 deletions
13
README.md
13
README.md
|
|
@ -32,6 +32,19 @@ export KEYCTL_ENDPOINT=http://127.0.0.1:7070
|
||||||
./keyctl get -id aabbccddeeff...
|
./keyctl get -id aabbccddeeff...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Get secret of type `shamir` with share via environment variable:
|
||||||
|
|
||||||
|
```
|
||||||
|
export KEYCTL_SHARE=aabbccddeeff...
|
||||||
|
./keyctl get -id aabbccddeeff...
|
||||||
|
```
|
||||||
|
|
||||||
|
Get secret of type `shamir` with share via commandline flag:
|
||||||
|
|
||||||
|
```
|
||||||
|
./keyctl get -id aabbccddeeff... -share aabbccddeeff...
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,8 @@ func Run(arg string) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exit(err)
|
exit(err)
|
||||||
}
|
}
|
||||||
switch k.Type {
|
|
||||||
case core.Plain:
|
|
||||||
fmt.Println("Key ID:", k.ID)
|
|
||||||
case core.Shamir:
|
|
||||||
fmt.Println("Key ID:", k.ID)
|
fmt.Println("Key ID:", k.ID)
|
||||||
|
if k.Type == core.Shamir {
|
||||||
fmt.Println("Key Share:", k.Key)
|
fmt.Println("Key Share:", k.Key)
|
||||||
}
|
}
|
||||||
case "del":
|
case "del":
|
||||||
|
|
@ -94,11 +91,11 @@ func Run(arg string) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exit(err)
|
exit(err)
|
||||||
}
|
}
|
||||||
key.Key = out
|
|
||||||
if json {
|
if json {
|
||||||
|
key.Key = out
|
||||||
jsonOutput(key) // does not return
|
jsonOutput(key) // does not return
|
||||||
}
|
}
|
||||||
fmt.Println(key.Key)
|
fmt.Println(out)
|
||||||
case "ls":
|
case "ls":
|
||||||
json := outputFlags()
|
json := outputFlags()
|
||||||
c := client()
|
c := client()
|
||||||
|
|
@ -164,6 +161,9 @@ func getFlags() (id, share string, json bool, err error) {
|
||||||
if id == "" {
|
if id == "" {
|
||||||
err = errors.New("missing flag: id")
|
err = errors.New("missing flag: id")
|
||||||
}
|
}
|
||||||
|
if share == "" {
|
||||||
|
share = os.Getenv("KEYCTL_SHARE")
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue