MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / loadPluginBootstrapConfig

Function loadPluginBootstrapConfig

cmd/server/main.go:748–771  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

746}
747
748func loadPluginBootstrapConfig(path string) *config.Config {
749 raw, errReadFile := os.ReadFile(path)
750 if errReadFile != nil {
751 if !errors.Is(errReadFile, os.ErrNotExist) {
752 log.Warnf("failed to read plugin bootstrap config: %v", errReadFile)
753 }
754 cfg := &config.Config{}
755 cfg.NormalizePluginsConfig()
756 return cfg
757 }
758 if len(strings.TrimSpace(string(raw))) == 0 {
759 cfg := &config.Config{}
760 cfg.NormalizePluginsConfig()
761 return cfg
762 }
763 cfg, errParseConfig := config.ParseConfigBytes(raw)
764 if errParseConfig != nil {
765 log.Warnf("failed to parse plugin bootstrap config: %v", errParseConfig)
766 cfg = &config.Config{}
767 cfg.NormalizePluginsConfig()
768 return cfg
769 }
770 return cfg
771}

Callers 1

mainFunction · 0.85

Calls 2

ParseConfigBytesFunction · 0.92

Tested by

no test coverage detected