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.
()
| 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. |
| 121 | func 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. |
| 135 | func replaceRingPath(path string) ([]byte, error) { |
no test coverage detected