21 lines
515 B
Go
21 lines
515 B
Go
|
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")
|
||
|
}
|
||
|
}
|