Skip to content

Commit

Permalink
Set env secret on tpsync too (#39)
Browse files Browse the repository at this point in the history
We removed the env default from the flag, but then only set the env var on the
web server. This sets it on the tpsync instance too if needed.

The multiple copies of the secret is a bit jank so might refactor it a bit, now
is not that time tho.
  • Loading branch information
lstoll committed Mar 18, 2024
1 parent 793ba03 commit 7d64ff9
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,21 @@ func main() {
}

if !disableTripitSync {
if v := os.Getenv("TRIPIT_API_KEY"); v != "" && ws.tripitAPIKey == "" {
ws.tripitAPIKey = v
if v := os.Getenv("TRIPIT_API_KEY"); v != "" {
if ws.tripitAPIKey == "" {
ws.tripitAPIKey = v
}
if tpsync.oauthAPIKey == "" {
tpsync.oauthAPIKey = v
}
}
if v := os.Getenv("TRIPIT_API_SECRET"); v != "" && ws.tripitAPISecret == "" {
ws.tripitAPISecret = v
if v := os.Getenv("TRIPIT_API_SECRET"); v != "" {
if ws.tripitAPISecret == "" {
ws.tripitAPISecret = v
}
if tpsync.oauthAPISecret == "" {
tpsync.oauthAPISecret = v
}
}

if ws.tripitAPIKey == "" || ws.tripitAPISecret == "" {
Expand Down

0 comments on commit 7d64ff9

Please sign in to comment.