map-dots/run/common.go

21 lines
516 B
Go
Raw Normal View History

2023-08-11 14:32:44 +01:00
package run
import (
"fmt"
"os"
2023-08-11 14:38:49 +01:00
"git.fjla.uk/fred.boniface/map-dots/log"
2023-08-11 14:32:44 +01:00
)
func envCheck() {
log.Msg.Debug("reading Traccar credentials from environment")
user := os.Getenv("TRACCAR_USER")
pass := os.Getenv("TRACCAR_PASS")
if user == "" || pass == "" {
fmt.Println("To use Traccar, you must set the environment variables:\n'TRACCAR_USER', 'TRACCAR_PASS', and for CLI use only 'TRACCAR_DEVID'")
os.Stdout.Sync() // Flush the output buffer
log.Msg.Fatal("Unable to read values from environment")
}
}