Skip to content

Commit 555e94e

Browse files
treydockSimon Plourde
authored and
Simon Plourde
committed
Add support for sensu-backend service environment variables (#3335)
Fixes #2680 Signed-off-by: Trey Dockendorf <[email protected]>
1 parent 9ca66d2 commit 555e94e

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Versioning](http://semver.org/spec/v2.0.0.html).
1111
- Added the `APIKey` resource and HTTP API support for POST, GET, and DELETE.
1212
- Added sensuctl commands to manage the `APIKey` resource.
1313
- Added support for api keys to be used in api authentication.
14+
- Added support for sensu-backend service environment variables
1415

1516
## [5.14.1] - 2019-10-16
1617

backend/cmd/start.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"os"
99
"os/signal"
1010
"path/filepath"
11+
"strings"
1112
"syscall"
1213

1314
corev2 "github.com/sensu/sensu-go/api/core/v2"
@@ -412,6 +413,10 @@ func StartCommand(initialize initializeFunc) *cobra.Command {
412413
viper.RegisterAlias(deprecatedFlagEtcdNodeName, flagEtcdNodeName)
413414
viper.RegisterAlias(deprecatedFlagEtcdPeerURLs, flagEtcdPeerURLs)
414415

416+
viper.SetEnvPrefix("sensu_backend")
417+
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
418+
viper.AutomaticEnv()
419+
415420
// Use our custom template for the start command
416421
cobra.AddTemplateFunc("categoryFlags", categoryFlags)
417422
cmd.SetUsageTemplate(startUsageTemplate)

0 commit comments

Comments
 (0)