Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
config.yaml
meteor
_recipes
meteor.yaml

# plugins
meteor-plugin-*
Expand Down
9 changes: 9 additions & 0 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func RunCmd(lg log.Logger, mt *metrics.StatsdMonitor, cfg config.Config) *cobra.
pathToConfig string
success = 0
failures = 0
configFile string
)

cmd := &cobra.Command{
Expand Down Expand Up @@ -56,6 +57,13 @@ func RunCmd(lg log.Logger, mt *metrics.StatsdMonitor, cfg config.Config) *cobra.
"group:core": "true",
},
RunE: func(cmd *cobra.Command, args []string) error {
if configFile != "" {
var err error
cfg, err = config.LoadFromPath(configFile)
if err != nil {
return err
}
}

cs := term.NewColorScheme()
runner := agent.NewAgent(agent.Config{
Expand Down Expand Up @@ -123,6 +131,7 @@ func RunCmd(lg log.Logger, mt *metrics.StatsdMonitor, cfg config.Config) *cobra.
}

cmd.Flags().StringVar(&pathToConfig, "var", "", "Path to Config file with env variables for recipe")
cmd.Flags().StringVarP(&configFile, "config", "c", "./meteor.yaml", "file path for agent level config")

return cmd
}
12 changes: 12 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,15 @@ func Load() (cfg Config, err error) {

return
}

func LoadFromPath(configFile string) (cfg Config, err error) {
err = config.
NewLoader(config.WithFile(configFile)).
Load(&cfg)
if errors.As(err, &config.ConfigFileNotFoundError{}) {
log.Println(err)
err = nil
}

return
}