diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-10-11 00:24:02 +0200 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-10-11 00:24:02 +0200 |
commit | 4695555e178bcabe54c5bf82117c9c4cef5440b5 (patch) | |
tree | 96a8721de74347450b2e4922004b1bf01e415dfa /lib/agent/agent.go | |
parent | 882944a748d123c8715eca88536299d8570858f9 (diff) |
Fixed Syncthing folder status events and exec command.
Diffstat (limited to 'lib/agent/agent.go')
-rw-r--r-- | lib/agent/agent.go | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/lib/agent/agent.go b/lib/agent/agent.go index 29b0622..3bdd89f 100644 --- a/lib/agent/agent.go +++ b/lib/agent/agent.go @@ -20,18 +20,19 @@ const cookieMaxAge = "3600" // Context holds the Agent context structure type Context struct { - ProgName string - Config *xdsconfig.Config - Log *logrus.Logger - SThg *st.SyncThing - SThgCmd *exec.Cmd - SThgInotCmd *exec.Cmd - - webServer *WebServer + ProgName string + Config *xdsconfig.Config + Log *logrus.Logger + LogLevelSilly bool + SThg *st.SyncThing + SThgCmd *exec.Cmd + SThgInotCmd *exec.Cmd + + webServer *WebServer xdsServers map[string]*XdsServer - sessions *Sessions - events *Events - projects *Projects + sessions *Sessions + events *Events + projects *Projects Exit chan os.Signal } @@ -53,15 +54,18 @@ func NewAgent(cliCtx *cli.Context) *Context { } log.Formatter = &logrus.TextFormatter{} + sillyVal, sillyLog := os.LookupEnv("XDS_LOG_SILLY") + // Define default configuration ctx := Context{ - ProgName: cliCtx.App.Name, - Log: log, - Exit: make(chan os.Signal, 1), + ProgName: cliCtx.App.Name, + Log: log, + LogLevelSilly: (sillyLog && sillyVal == "1"), + Exit: make(chan os.Signal, 1), - webServer: nil, + webServer: nil, xdsServers: make(map[string]*XdsServer), - events: nil, + events: nil, } // register handler on SIGTERM / exit |