MCPcopy Index your code
hub / github.com/perkeep/perkeep / configParser

Function configParser

pkg/serverinit/serverinit_test.go:121–132  ·  view source on GitHub ↗

configParser returns a custom jsonconfig ConfigParser whose reader rewrites "/path/to/secring" to the absolute path of the jsonconfig test-secring.gpg file. On windows, it also fixes the slash separated paths.

()

Source from the content-addressed store, hash-verified

119// "/path/to/secring" to the absolute path of the jsonconfig test-secring.gpg file.
120// On windows, it also fixes the slash separated paths.
121func configParser() *jsonconfig.ConfigParser {
122 return &jsonconfig.ConfigParser{
123 Open: func(path string) (jsonconfig.File, error) {
124 slurp, err := replaceRingPath(path)
125 if err != nil {
126 return nil, err
127 }
128 slurp = backslashEscape(slurp)
129 return namedReadSeeker{path, bytes.NewReader(slurp)}, nil
130 },
131 }
132}
133
134// replaceRingPath returns the contents of the file at path with secringPlaceholder replaced with the absolute path of relativeRing.
135func replaceRingPath(path string) ([]byte, error) {

Callers 1

testConfigFunction · 0.85

Calls 2

replaceRingPathFunction · 0.85
backslashEscapeFunction · 0.85

Tested by

no test coverage detected