Be more like a library to support mobile (#247)

This commit is contained in:
Nathan Brown
2020-06-30 13:48:58 -05:00
committed by GitHub
parent 1ea8847085
commit 41578ca971
21 changed files with 477 additions and 69 deletions

View File

@ -3,6 +3,7 @@ package main
import (
"flag"
"fmt"
"github.com/sirupsen/logrus"
"os"
"github.com/slackhq/nebula"
@ -39,5 +40,25 @@ func main() {
os.Exit(1)
}
nebula.Main(*configPath, *configTest, Build)
config := nebula.NewConfig()
err := config.Load(*configPath)
if err != nil {
fmt.Printf("failed to load config: %s", err)
os.Exit(1)
}
l := logrus.New()
l.Out = os.Stdout
err = nebula.Main(config, *configTest, true, Build, l, nil, nil)
switch v := err.(type) {
case nebula.ContextualError:
v.Log(l)
os.Exit(1)
case error:
l.WithError(err).Error("Failed to start")
os.Exit(1)
}
os.Exit(0)
}