fix(windows): Ensure watch-config is passed to service (#15040)

This commit is contained in:
Joshua Powers 2024-03-21 14:26:43 -06:00 committed by GitHub
parent dfdb804064
commit 21f355a59c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -128,6 +128,10 @@ func (t *Telegraf) runAsWindowsService() error {
svcConfig.Arguments = append(svcConfig.Arguments, "--config-directory", fConfigDirectory)
}
if t.watchConfig != "" {
svcConfig.Arguments = append(svcConfig.Arguments, "--watch-config", t.watchConfig)
}
//set servicename to service cmd line, to have a custom name after relaunch as a service
svcConfig.Arguments = append(svcConfig.Arguments, "--service-name", t.serviceName)