From 682049b49cb2cfee4f6bce574930de9987b4e65f Mon Sep 17 00:00:00 2001 From: braginini Date: Wed, 5 May 2021 12:15:55 +0200 Subject: [PATCH] chore: add a bit more logs to the init command --- cmd/init.go | 13 ++++++++++++- signal/Dockerfile | 13 +++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 signal/Dockerfile diff --git a/cmd/init.go b/cmd/init.go index 8edeadc426c..a66cf9a89c7 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -30,8 +30,17 @@ var ( if wgKey == "" { wgKey = generateKey() + log.Warnf("there was no Wireguard private key specified, a new Wireguard key has been generated") } + parsedKey, err := wgtypes.ParseKey(wgKey) + if err != nil { + log.Errorf("invalid Wireguard private key %s", wgKey) + os.Exit(ExitSetupFailed) + } + + log.Infof("my public Wireguard key is %s", parsedKey.PublicKey().String()) + var stunTurnURLs []*ice.URL stuns := strings.Split(stunURLs, ",") for _, url := range stuns { @@ -80,11 +89,13 @@ var ( WgIface: wgInterface, } - err := config.Write(configPath) + err = config.Write(configPath) if err != nil { log.Errorf("failed writing config to %s: %s", config, err.Error()) os.Exit(ExitSetupFailed) } + + log.Infof("a new config has been generated and written to %s", configPath) }, } ) diff --git a/signal/Dockerfile b/signal/Dockerfile new file mode 100644 index 00000000000..e09ad387e70 --- /dev/null +++ b/signal/Dockerfile @@ -0,0 +1,13 @@ +FROM docker.io/golang:1.16 AS build + +WORKDIR /src + +COPY go.mod . +COPY . . + +RUN go mod download +RUN go install . + +FROM gcr.io/distroless/base +COPY --from=build /go/bin/wiretrustee-hub / +ENTRYPOINT [ "/wiretrustee-hub" ]