-
-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathshamhub.go
More file actions
34 lines (28 loc) · 756 Bytes
/
Copy pathshamhub.go
File metadata and controls
34 lines (28 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//go:build shamhub
package main
import (
"fmt"
"os"
"go.abhg.dev/gs/internal/forge"
"go.abhg.dev/gs/internal/forge/shamhub"
"go.abhg.dev/gs/internal/secret/secretserver"
"go.abhg.dev/gs/internal/silog"
)
func init() {
if err := configureShamHubSecretStash(os.Getenv); err != nil {
panic(err)
}
_extraForges = append(_extraForges, func(log *silog.Logger) forge.Definition {
return &shamhub.Definition{Log: log}
})
}
func configureShamHubSecretStash(getenv func(string) string) error {
if secretURL := getenv("SHAMHUB_SECRET_URL"); secretURL != "" {
secretStash, err := secretserver.NewClient(secretURL)
if err != nil {
return fmt.Errorf("create ShamHub secret client: %w", err)
}
_keyringStash = secretStash
}
return nil
}