mirror of
https://github.com/fosrl/newt.git
synced 2025-05-12 21:20:39 +01:00
Add env vars?
This commit is contained in:
parent
72d145aaa5
commit
0a09e6d1fc
2 changed files with 6 additions and 7 deletions
2
Makefile
2
Makefile
|
@ -8,7 +8,7 @@ push:
|
|||
docker push fossorial/newt:latest
|
||||
|
||||
test:
|
||||
docker run -it -p 3002:3002 -v ./config_example.json:/config/config.json --cap-add=NET_ADMIN --cap-add=SYS_MODULE newt --config /config/config.json
|
||||
docker run fossorial/newt:latest
|
||||
|
||||
local:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o newt
|
||||
|
|
11
main.go
11
main.go
|
@ -248,16 +248,15 @@ func main() {
|
|||
flag.StringVar(&logLevel, "log-level", getEnvWithDefault("LOG_LEVEL", "INFO"), "Log level (DEBUG, INFO, WARN, ERROR, FATAL)")
|
||||
flag.Parse()
|
||||
|
||||
// Validate required fields
|
||||
if endpoint == "" || id == "" || secret == "" {
|
||||
logger.Fatal("endpoint, id, and secret are required either via CLI flags or environment variables")
|
||||
|
||||
}
|
||||
|
||||
logger.Init()
|
||||
loggerLevel := parseLogLevel(logLevel)
|
||||
logger.GetLogger().SetLevel(parseLogLevel(logLevel))
|
||||
|
||||
// Validate required fields
|
||||
if endpoint == "" || id == "" || secret == "" {
|
||||
logger.Fatal("endpoint, id, and secret are required either via CLI flags or environment variables")
|
||||
}
|
||||
|
||||
privateKey, err = wgtypes.GeneratePrivateKey()
|
||||
if err != nil {
|
||||
logger.Fatal("Failed to generate private key: %v", err)
|
||||
|
|
Loading…
Reference in a new issue