MCPcopy Create free account
hub / github.com/crashappsec/github-analyzer / initializeConfig

Function initializeConfig

cmd/github-analyzer/main.go:208–225  ·  view source on GitHub ↗
(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

206}
207
208func initializeConfig(cmd *cobra.Command) error {
209 v := viper.New()
210 v.SetDefault("Verbose", true)
211 // TODO add a file-based config
212 v.SetConfigName(config.ConfigFileBasename)
213 v.AddConfigPath(".")
214 if err := v.ReadInConfig(); err != nil {
215 if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
216 return err
217 }
218 }
219
220 v.SetEnvPrefix(config.ViperEnvPrefix)
221 v.AutomaticEnv()
222 bindFlags(cmd, v)
223
224 return nil
225}
226
227// bindFlags binds cobra flags to viper environment variables
228func bindFlags(cmd *cobra.Command, v *viper.Viper) {

Callers 1

NewRootCommandFunction · 0.85

Calls 1

bindFlagsFunction · 0.85

Tested by

no test coverage detected