Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit 02e67ae

Browse files
committed
Output the paths of the written secrets in demo init
1 parent f6bdf43 commit 02e67ae

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

internals/demo/init.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"crypto/sha256"
66
"encoding/base64"
77
"errors"
8+
"fmt"
89

910
"github.com/secrethub/secrethub-cli/internals/cli/ui"
1011
"github.com/secrethub/secrethub-cli/internals/secrethub/command"
@@ -70,18 +71,22 @@ func (cmd *InitCommand) Run() error {
7071
return err
7172
}
7273

73-
_, err = client.Secrets().Write(secretpath.Join(repoPath, "username"), []byte(username))
74+
usernamePath := secretpath.Join(repoPath, "username")
75+
_, err = client.Secrets().Write(usernamePath, []byte(username))
7476
if err != nil {
7577
return err
7678
}
7779

7880
h := hmac.New(sha256.New, []byte("this-is-no-good-way-to-generate-a-password-that-is-why-we-only-use-it-for-demo-purposes"))
7981
password := base64.RawStdEncoding.EncodeToString(h.Sum([]byte(username)))[:20]
8082

81-
_, err = client.Secrets().Write(secretpath.Join(repoPath, "password"), []byte(password))
83+
passwordPath := secretpath.Join(repoPath, "password")
84+
_, err = client.Secrets().Write(passwordPath, []byte(password))
8285
if err != nil {
8386
return err
8487
}
8588

89+
fmt.Printf("Created the following secrets:\n%s\n%s\n", usernamePath, passwordPath)
90+
8691
return nil
8792
}

0 commit comments

Comments
 (0)