chore: fix tesla command build
This commit is contained in:
parent
5474bb3879
commit
68588cc5bf
5 changed files with 17 additions and 6 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
2
Makefile
2
Makefile
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue