From d43f503474b52b542a3850ab2c2e5b1e730216d1 Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 25 Oct 2020 16:06:22 +0100 Subject: [PATCH] Use token secret for docker build --- Dockerfile | 3 ++- docker/tmpl.Dockerfile | 2 +- vehicle/audi.go | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index bdbc8b746..72b4bba3c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,8 @@ COPY go.sum . RUN go mod download COPY . . -RUN make clean install assets build +RUN make clean install assets +RUN AUDI_HASH_SECRET={{ env "AUDI_HASH_SECRET" }} make build # # STEP 2 build a small image including module support diff --git a/docker/tmpl.Dockerfile b/docker/tmpl.Dockerfile index 08b10e4a5..753e07900 100644 --- a/docker/tmpl.Dockerfile +++ b/docker/tmpl.Dockerfile @@ -17,7 +17,7 @@ RUN go mod download COPY . . RUN make clean install assets -RUN GOARCH={{ .GoARCH }} GOARM={{ .GoARM }} make build +RUN GOARCH={{ .GoARCH }} GOARM={{ .GoARM }} AUDI_HASH_SECRET={{ env "AUDI_HASH_SECRET" }} make build ############################# ## STEP 2 build a small image diff --git a/vehicle/audi.go b/vehicle/audi.go index 16586a450..054293741 100644 --- a/vehicle/audi.go +++ b/vehicle/audi.go @@ -133,8 +133,8 @@ func (v *Audi) authFlow() error { }) var hash string - var secret []byte - if secret, err = hex.DecodeString(AudiHashSecret); err == nil { + secret, err := hex.DecodeString(AudiHashSecret) + if err == nil { // timestamp rounded to 100s precision ts := strconv.FormatInt(time.Now().Unix()/100, 10)