Skip to content

Commit

Permalink
refactor(cmd): root
Browse files Browse the repository at this point in the history
Config file handling
  • Loading branch information
sundowndev committed Aug 30, 2020
1 parent 6432b43 commit 60bca87
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"github.com/spf13/cobra"
)

var cfgFile string

var rootCmd = &cobra.Command{
Use: "gilfoyle [COMMANDS] [OPTIONS]",
Short: "Video streaming API server",
Expand All @@ -18,12 +16,12 @@ var rootCmd = &cobra.Command{
}

func init() {
err := config.NewConfig()
cfgFile := rootCmd.PersistentFlags().String("config", "", "config file path (default ./gilfoyle.yaml")

err := config.NewConfig(cfgFile)
if err != nil {
panic(err)
}

rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file path (default ./gilfoyle.yaml")
}

// Execute is a function that executes the root command
Expand Down

0 comments on commit 60bca87

Please sign in to comment.