map-dots/run/common.go

21 lines
515 B
Go
Raw Normal View History

2023-08-11 14:32:44 +01:00
package run
import (
"fmt"
"os"
"git.fjla.uk/fred.boniface/map-dot/log"
)
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")
}
}