9 "github.com/Sirupsen/logrus"
10 "github.com/codegangsta/cli"
11 "github.com/iotbzh/xds-server/lib/xdsconfig"
12 "github.com/iotbzh/xds-server/lib/xdsserver"
16 appName = "xds-server"
17 appDescription = "X(cross) Development System Server is a web server that allows to remotely cross build applications."
18 appCopyright = "Apache-2.0"
19 appUsage = "X(cross) Development System Server"
22 var appAuthors = []cli.Author{
23 cli.Author{Name: "Sebastien Douheret", Email: "sebastien@iot.bzh"},
26 // AppVersion is the version of this application
27 var AppVersion = "?.?.?"
29 // AppSubVersion is the git tag id added to version string
30 // Should be set by compilation -ldflags "-X main.AppSubVersion=xxx"
31 var AppSubVersion = "unknown-dev"
33 // XDS Server application main routine
34 func xdsApp(cliCtx *cli.Context) error {
37 // Create XDS server context
38 ctxSvr := xdsserver.NewXdsServer(cliCtx)
41 ctxSvr.Config, err = xdsconfig.Init(cliCtx, ctxSvr.Log)
43 return cli.NewExitError(err, -2)
46 // Run XDS Server (main loop)
47 errCode, err := ctxSvr.Run()
49 return cli.NewExitError(err, errCode)
55 // Create a new instance of the logger
58 // Create a new App instance
61 app.Description = appDescription
63 app.Version = AppVersion + " (" + AppSubVersion + ")"
64 app.Authors = appAuthors
65 app.Copyright = appCopyright
66 app.Metadata = make(map[string]interface{})
67 app.Metadata["version"] = AppVersion
68 app.Metadata["git-tag"] = AppSubVersion
69 app.Metadata["logger"] = log
71 app.Flags = []cli.Flag{
74 Usage: "JSON config file to use\n\t",
80 Usage: "logging level (supported levels: panic, fatal, error, warn, info, debug)\n\t",
86 Usage: "filename where logs will be redirected (default stdout)\n\t",
87 EnvVar: "LOG_FILENAME",
90 Name: "no-folderconfig, nfc",
91 Usage: fmt.Sprintf("Do not read folder config file (%s)\n\t", xdsconfig.FoldersConfigFilename),
92 EnvVar: "NO_FOLDERCONFIG",
96 // only one action: Web Server