// NewConfig creates a new, immutable configuration object. This object
// holds the Viper configuration and the logger, and is validated. The
// JIRA configuration is not yet initialized.
NewConfig creates a new, immutable configuration object. This object
holds the Viper configuration and the logger, and is validated. The
JIRA configuration is not yet initialized.
// NewConfig creates a new immutable configuration object . This object // holds the Viper configuration and the logger and is validated . The // JIRA configuration is not yet initialized .
func NewConfig(cmd *cobra.Command) (Config, error) {
	config := Config{}
	var err error
	config.cmdFile, err = cmd.Flags().GetString("config")
	if err != nil {
		config.cmdFile = ""
	}
	config.cmdConfig = *newViper("issue-sync", config.cmdFile)
	config.cmdConfig.BindPFlags(cmd.Flags())
	config.cmdFile = config.cmdConfig.ConfigFileUsed()
	config.log = *newLogger("issue-sync", config.cmdConfig.GetString("log-level"))
	if err := config.validateConfig(); err != nil {
		return Config{}, err
	}
	return config, nil
}
func NewConfig ( cmd * cobra . Command ) ( Config , error ) { config := Config { } var err error config . cmdFile , err = cmd . Flags ( ) . GetString ( " " ) if err != nil { config . cmdFile = " " } config . cmdConfig = * newViper ( " " , config . cmdFile ) config . cmdConfig . BindPFlags ( cmd . Flags ( ) ) config . cmdFile = config . cmdConfig . ConfigFileUsed ( ) config . log = * newLogger ( " " , config . cmdConfig . GetString ( " " ) ) if err := config . validateConfig ( ) ; err != nil { return Config { } , err } return config , nil }
NewConfig creates a new, immutable configuration object.
NewConfig creates a new immutable configuration object .