Skip to content

Commit

Permalink
pass multiple envfiles in start command
Browse files Browse the repository at this point in the history
  • Loading branch information
evandam committed Sep 6, 2023
1 parent 37490f2 commit 2b47cc0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cmd/commandfuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ func cmdStart(fl Flags) (int, error) {
startCmdConfigAdapterFlag := fl.String("adapter")
startCmdPidfileFlag := fl.String("pidfile")
startCmdWatchFlag := fl.Bool("watch")
startCmdEnvfileFlag := fl.String("envfile")

var err error
var startCmdEnvfileFlag []string
startCmdEnvfileFlag, err = fl.GetStringSlice("envfile")
if err != nil {
return caddy.ExitCodeFailedStartup,
fmt.Errorf("reading envfile flag: %v", err)
}

// open a listener to which the child process will connect when
// it is ready to confirm that it has successfully started
Expand All @@ -70,8 +77,9 @@ func cmdStart(fl Flags) (int, error) {
if startCmdConfigFlag != "" {
cmd.Args = append(cmd.Args, "--config", startCmdConfigFlag)
}
if startCmdEnvfileFlag != "" {
cmd.Args = append(cmd.Args, "--envfile", startCmdEnvfileFlag)

for _, envFile := range startCmdEnvfileFlag {
cmd.Args = append(cmd.Args, "--envfile", envFile)
}
if startCmdConfigAdapterFlag != "" {
cmd.Args = append(cmd.Args, "--adapter", startCmdConfigAdapterFlag)
Expand Down

0 comments on commit 2b47cc0

Please sign in to comment.