aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xdsserver/xdsserver.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xdsserver/xdsserver.go')
-rw-r--r--lib/xdsserver/xdsserver.go50
1 files changed, 28 insertions, 22 deletions
diff --git a/lib/xdsserver/xdsserver.go b/lib/xdsserver/xdsserver.go
index 1079eba..e96ab57 100644
--- a/lib/xdsserver/xdsserver.go
+++ b/lib/xdsserver/xdsserver.go
@@ -37,22 +37,23 @@ const cookieMaxAge = "3600"
// Context holds the XDS server context
type Context struct {
- ProgName string
- Cli *cli.Context
- Config *xdsconfig.Config
- Log *logrus.Logger
- LogLevelSilly bool
- LogSillyf func(format string, args ...interface{})
- SThg *st.SyncThing
- SThgCmd *exec.Cmd
- SThgInotCmd *exec.Cmd
- mfolders *Folders
- sdks *SDKs
- targets *Targets
- WWWServer *WebServer
- sessions *Sessions
- events *Events
- Exit chan os.Signal
+ ProgName string
+ Cli *cli.Context
+ Config *xdsconfig.Config
+ Log *logrus.Logger
+ LogLevelSilly bool
+ LogSillyf func(format string, args ...interface{})
+ SThg *st.SyncThing
+ SThgCmd *exec.Cmd
+ SThgInotCmd *exec.Cmd
+ mfolders *Folders
+ sdks *SDKs
+ targets *Targets
+ WWWServer *WebServer
+ sessions *Sessions
+ events *Events
+ lockXdsSrvUpdate LockXdsUpdate
+ Exit chan os.Signal
}
// NewXdsServer Create a new instance of XDS server
@@ -83,12 +84,13 @@ func NewXdsServer(cliCtx *cli.Context) *Context {
// Define default configuration
ctx := Context{
- ProgName: cliCtx.App.Name,
- Cli: cliCtx,
- Log: log,
- LogLevelSilly: logSilly,
- LogSillyf: sillyFunc,
- Exit: make(chan os.Signal, 1),
+ ProgName: cliCtx.App.Name,
+ Cli: cliCtx,
+ Log: log,
+ LogLevelSilly: logSilly,
+ LogSillyf: sillyFunc,
+ lockXdsSrvUpdate: LockXdsUpdate{LockCpt: 0},
+ Exit: make(chan os.Signal, 1),
}
// register handler on SIGTERM / exit
@@ -206,6 +208,10 @@ func (ctx *Context) Run() (int, error) {
// Sessions manager
ctx.sessions = ClientSessionsConstructor(ctx, cookieMaxAge)
+ // Check if a new package version is available
+ // and monitor updates
+ MonitorUpdates(ctx)
+
// Run Web Server until exit requested (blocking call)
if err = ctx.WWWServer.Serve(); err != nil {
ctx.Log.Println(err)