Skip to content

Commit

Permalink
chore: fix tesla command build
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Jan 24, 2024
1 parent 5474bb3 commit 68588cc
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .goreleaser-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ builds:
- -trimpath
- -tags=release
ldflags:
- -X github.com/evcc-io/evcc/server.Version={{ .Tag }} -X github.com/evcc-io/evcc/server.Commit={{ .ShortCommit }} -X github.com/evcc-io/evcc/vehicle/tesla-vehicle-command.OAuth2Config.ClientID={{ .Env.TESLA_CLIENT_ID }} -s -w
- -X github.com/evcc-io/evcc/server.Version={{ .Tag }} -X github.com/evcc-io/evcc/server.Commit={{ .ShortCommit }} -X github.com/evcc-io/evcc/vehicle/tesla-vehicle-command.TESLA_CLIENT_ID={{ .Env.TESLA_CLIENT_ID }} -s -w
env:
- CGO_ENABLED=0
goos:
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ builds:
- -trimpath
- -tags=release
ldflags:
- -X github.com/evcc-io/evcc/server.Version={{ .Version }} -X github.com/evcc-io/evcc/vehicle/tesla-vehicle-command.OAuth2Config.ClientID={{ .Env.TESLA_CLIENT_ID }} -s -w
- -X github.com/evcc-io/evcc/server.Version={{ .Version }} -X github.com/evcc-io/evcc/vehicle/tesla-vehicle-command.TESLA_CLIENT_ID={{ .Env.TESLA_CLIENT_ID }} -s -w
env:
- CGO_ENABLED=0
goos:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ RUN case "${TARGETVARIANT}" in \
"v7") export GOARM='7' ;; \
esac;

ARG TESLA_CLIENT_ID
ENV TESLA_CLIENT_ID=${TESLA_CLIENT_ID}

RUN RELEASE=${RELEASE} GOOS=${TARGETOS} GOARCH=${TARGETARCH} make build


Expand All @@ -77,9 +80,6 @@ COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /build/evcc /usr/local/bin/evcc

ARG TESLA_CLIENT_ID
ENV TESLA_CLIENT_ID=${TESLA_CLIENT_ID}

COPY packaging/docker/bin/* /app/

# mDNS
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ VERSION := $(if $(TAG_NAME),$(TAG_NAME),$(SHA))
BUILD_DATE := $(shell date -u '+%Y-%m-%d_%H:%M:%S')
BUILD_TAGS := -tags=release
TESLA_CLIENT_ID := ${TESLA_CLIENT_ID}
LD_FLAGS := -X github.com/evcc-io/evcc/server.Version=$(VERSION) -X github.com/evcc-io/evcc/server.Commit=$(COMMIT) -X github.com/evcc-io/evcc/vehicle/tesla-vehicle-command.OAuth2Config.ClientID=$(TESLA_CLIENT_ID) -s -w
LD_FLAGS := -X github.com/evcc-io/evcc/server.Version=$(VERSION) -X github.com/evcc-io/evcc/server.Commit=$(COMMIT) -X github.com/evcc-io/evcc/vehicle/tesla-vehicle-command.TESLA_CLIENT_ID=$(TESLA_CLIENT_ID) -s -w
BUILD_ARGS := -trimpath -ldflags='$(LD_FLAGS)'

# docker
Expand Down
11 changes: 11 additions & 0 deletions vehicle/tesla-vehicle-command/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ var OAuth2Config = &oauth2.Config{

const userAgent = "evcc/evcc-io"

var TESLA_CLIENT_ID, TESLA_CLIENT_SECRET string

func init() {
if TESLA_CLIENT_ID != "" {
OAuth2Config.ClientID = TESLA_CLIENT_ID
}
if TESLA_CLIENT_SECRET != "" {
OAuth2Config.ClientSecret = TESLA_CLIENT_SECRET
}
}

type Identity struct {
oauth2.TokenSource
log *util.Logger
Expand Down

0 comments on commit 68588cc

Please sign in to comment.