-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
35 lines (26 loc) · 855 Bytes
/
main.go
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
35
package main
import (
"log/slog"
"os"
"github.com/docker/docker-credential-helpers/credentials"
"github.com/jamestelfer/docker-credential-env/helper"
)
// Set at build time by Goreleaser
var Version string = "v0.0.0-unknown"
var Revision string = "unknown"
func main() {
// configure the plugin details in the credentials package
credentials.Name = "docker-credential-env"
credentials.Package = "github.com/jamestelfer/docker-credential-env/credentials"
credentials.Version = Version
credentials.Revision = Revision
configureLogging()
credentialsOptional := os.Getenv("DOCKER_CREDENTIALS_ENV_OPTIONAL") == "true"
credentials.Serve(helper.EnvHelper{CredentialsOptional: credentialsOptional})
}
func configureLogging() {
logger := slog.
New(slog.NewTextHandler(os.Stderr, nil)).
With("pid", os.Getpid())
slog.SetDefault(logger)
}