Skip to content

Commit

Permalink
Improve service command building
Browse files Browse the repository at this point in the history
  • Loading branch information
patricksanders committed Mar 26, 2021
1 parent e734974 commit 9958376
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions cmd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,12 @@ func initService() {

svcProgram = &program{}

args := []string{"service", "run"}
configArgs := viper.GetStringSlice("service.args")
if len(configArgs) > 0 {
args = append(args, configArgs...)
var args []string
for _, key := range []string{"service.flags", "service.args", "service.run"} {
configArgs := viper.GetStringSlice(key)
if len(configArgs) > 0 {
args = append(args, configArgs...)
}
}
svcConfig = &service.Config{
Name: "weep",
Expand Down
3 changes: 2 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ func init() {
viper.SetDefault("server.http_timeout", 20)
viper.SetDefault("server.address", "127.0.0.1")
viper.SetDefault("server.port", 9091)
viper.SetDefault("service.command", "ecs_credential_provider")
viper.SetDefault("service.command", "serve")
viper.SetDefault("service.run", []string{"service", "run"})
viper.SetDefault("service.args", []string{})
viper.SetDefault("service.flags", []string{})

Expand Down

0 comments on commit 9958376

Please sign in to comment.