Skip to content

Commit

Permalink
chore: add a bit more logs to the init command
Browse files Browse the repository at this point in the history
  • Loading branch information
braginini committed May 5, 2021
1 parent 19e43c6 commit 682049b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
},
}
)
Expand Down
13 changes: 13 additions & 0 deletions signal/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]

0 comments on commit 682049b

Please sign in to comment.