MCPcopy Create free account
hub / github.com/archlinux-de/pkgstats-cli / parseConfigFile

Method parseConfigFile

internal/pacman/parser.go:46–66  ·  view source on GitHub ↗
(configPath string, defaultDBPath string)

Source from the content-addressed store, hash-verified

44}
45
46func (parser *parser) parseConfigFile(configPath string, defaultDBPath string) (*config, error) {
47 lines, err := parser.readConfigFile(configPath, 0)
48 if err != nil {
49 return nil, err
50 }
51
52 confMap := createConfigMap(lines)
53
54 dbPath, ok := confMap.Get("options", "DBPath")
55 if !ok {
56 dbPath = defaultDBPath
57 }
58 server, ok := confMap.Get(repository, "Server")
59 if !ok {
60 return nil, errors.New("server not found")
61 }
62 return &config{
63 dbPath: dbPath,
64 server: server,
65 }, nil
66}
67
68func (parser *parser) readConfigFile(fileName string, depth int) ([]string, error) {
69 if depth >= configMaxRecursion {

Callers 1

ParseFunction · 0.80

Calls 3

readConfigFileMethod · 0.95
createConfigMapFunction · 0.85
GetMethod · 0.80

Tested by

no test coverage detected