Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ Application Options:
delayed for a hard-coded period of 3 minutes. Can be specified multiple times.
--verbose Verbose output (optional)
--output= Path to the log file. If not set, write to stdout.
--config= Path to the config file.

Help Options:
-h, --help Show this help message
Expand Down
3 changes: 3 additions & 0 deletions internal/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ func Main() {
options := &Options{}
parser := goFlags.NewParser(options, goFlags.Default)
_, err := parser.Parse()
if err == nil && options.ConfigFile != "" {
err = goFlags.IniParse(options.ConfigFile, options)
}
if err != nil {
if flagsErr, ok := err.(*goFlags.Error); ok && flagsErr.Type == goFlags.ErrHelp {
os.Exit(0)
Expand Down
3 changes: 3 additions & 0 deletions internal/cmd/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ type Options struct {

// LogOutput is the optional path to the log file.
LogOutput string `long:"output" description:"Path to the log file. If not set, write to stdout."`

// ConfigFile is the optional path to the config file.
ConfigFile string `long:"config" description:"Path to the config file."`
}

// String implements fmt.Stringer interface for Options.
Expand Down