agent: only set the proxy manager data dir if its set

This commit is contained in:
Mitchell Hashimoto 2018-05-03 17:51:49 -07:00
parent 1a32435a4d
commit f5ccc65295
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
1 changed files with 6 additions and 1 deletions

View File

@ -363,7 +363,12 @@ func (a *Agent) Start() error {
a.proxyManager = proxy.NewManager()
a.proxyManager.State = a.State
a.proxyManager.Logger = a.logger
a.proxyManager.DataDir = filepath.Join(a.config.DataDir, "proxy")
if a.config.DataDir != "" {
// DataDir is required for all non-dev mode agents, but we want
// to allow setting the data dir for demos and so on for the agent,
// so do the check above instead.
a.proxyManager.DataDir = filepath.Join(a.config.DataDir, "proxy")
}
go a.proxyManager.Run()
// Start watching for critical services to deregister, based on their