MCPcopy Create free account
hub / github.com/1buran/rHttp / loadUserSettings

Function loadUserSettings

config.go:81–93  ·  view source on GitHub ↗

Load user settings. todo make it is more robust, do not silent errors from the one side and todo do not make a lot of noise / spam from the other...

(c *Config)

Source from the content-addressed store, hash-verified

79// todo make it is more robust, do not silent errors from the one side and
80// todo do not make a lot of noise / spam from the other...
81func loadUserSettings(c *Config) error {
82 userHome, _ := os.UserHomeDir() // ignore rare cases when user home is undefined
83 userConfig := filepath.Join(userHome, ".config/rhttp/config.json")
84 if _, err := os.Stat(userConfig); err != nil {
85 if errors.Is(err, os.ErrNotExist) { // it's ok if config is missed
86 return nil
87 } else {
88 return err
89 }
90 }
91
92 return loadJSON(userConfig, c)
93}
94func loadOverrideSettings(path string, c *Config) error {
95 if path == "" {
96 return nil // no config path passed

Callers 1

ReadConfigFunction · 0.85

Calls 1

loadJSONFunction · 0.85

Tested by

no test coverage detected