MCPcopy Index your code
hub / github.com/apache/answer / ReadConfig

Function ReadConfig

internal/base/conf/conf.go:99–114  ·  view source on GitHub ↗

ReadConfig read config

(configFilePath string)

Source from the content-addressed store, hash-verified

97
98// ReadConfig read config
99func ReadConfig(configFilePath string) (c *AllConfig, err error) {
100 if len(configFilePath) == 0 {
101 configFilePath = filepath.Join(path.ConfigFileDir, path.DefaultConfigFileName)
102 }
103 c = &AllConfig{}
104 config, err := viper.NewWithPath(configFilePath)
105 if err != nil {
106 return nil, err
107 }
108 if err = config.Parse(&c); err != nil {
109 return nil, err
110 }
111 c.SetDefault()
112 c.SetEnvironmentOverrides()
113 return c, nil
114}
115
116// RewriteConfig rewrite config file path
117func RewriteConfig(configFilePath string, allConfig *AllConfig) error {

Callers 6

ResetPasswordFunction · 0.92
CheckConfigFileFunction · 0.92
InitEnvironmentFunction · 0.92
InitBaseInfoFunction · 0.92
runAppFunction · 0.92
command.goFile · 0.92

Calls 3

ParseMethod · 0.80
SetDefaultMethod · 0.80

Tested by

no test coverage detected