Merge remote-tracking branch 'upstream/develop' into BigRefactor
This commit is contained in:
commit
a8dfa19b3a
9 changed files with 43 additions and 10 deletions
|
|
@ -109,6 +109,17 @@ func New(logger *logrus.Logger, version string) *Agent {
|
|||
},
|
||||
}
|
||||
|
||||
var natsProxyPath, natsProxyPort string
|
||||
if ac.NatsProxyPath == "" {
|
||||
natsProxyPath = "natsws"
|
||||
}
|
||||
|
||||
if ac.NatsProxyPort == "" {
|
||||
natsProxyPort = "443"
|
||||
}
|
||||
|
||||
natsServer := fmt.Sprintf("wss://%s:%s", ac.APIURL, natsProxyPort)
|
||||
|
||||
return &Agent{
|
||||
Hostname: info.Hostname,
|
||||
BaseURL: ac.BaseURL,
|
||||
|
|
@ -133,6 +144,9 @@ func New(logger *logrus.Logger, version string) *Agent {
|
|||
Platform: runtime.GOOS,
|
||||
GoArch: runtime.GOARCH,
|
||||
ServiceConfig: svcConf,
|
||||
NatsServer: natsServer,
|
||||
NatsProxyPath: natsProxyPath,
|
||||
NatsProxyPort: natsProxyPort,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -313,6 +327,7 @@ func (a *Agent) setupNatsOptions() []nats.Option {
|
|||
opts = append(opts, nats.RetryOnFailedConnect(true))
|
||||
opts = append(opts, nats.MaxReconnects(-1))
|
||||
opts = append(opts, nats.ReconnectBufSize(-1))
|
||||
opts = append(opts, nats.ProxyPath("natsws"))
|
||||
return opts
|
||||
}
|
||||
|
||||
|
|
@ -338,6 +353,7 @@ func (a *Agent) CleanupAgentUpdates() {
|
|||
return
|
||||
}
|
||||
|
||||
// winagent-v* is deprecated
|
||||
files, err := filepath.Glob("winagent-v*.exe")
|
||||
if err == nil {
|
||||
for _, f := range files {
|
||||
|
|
@ -345,6 +361,13 @@ func (a *Agent) CleanupAgentUpdates() {
|
|||
}
|
||||
}
|
||||
|
||||
agents, err := filepath.Glob("tacticalagent-v*.exe")
|
||||
if err == nil {
|
||||
for _, f := range agents {
|
||||
os.Remove(f)
|
||||
}
|
||||
}
|
||||
|
||||
cderr = os.Chdir(os.Getenv("TMP"))
|
||||
if cderr != nil {
|
||||
a.Logger.Errorln(cderr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue