LoadIndex loads and parses an index from the given filename. Leave platform empty to use current platform.
(filename string, platform string, trustStore jess.TrustStore)
| 135 | // LoadIndex loads and parses an index from the given filename. |
| 136 | // Leave platform empty to use current platform. |
| 137 | func LoadIndex(filename string, platform string, trustStore jess.TrustStore) (*Index, error) { |
| 138 | // Read index file from disk. |
| 139 | content, err := os.ReadFile(filename) |
| 140 | if err != nil { |
| 141 | return nil, fmt.Errorf("read index file: %w", err) |
| 142 | } |
| 143 | |
| 144 | // Parse and return. |
| 145 | return ParseIndex(content, platform, trustStore) |
| 146 | } |
| 147 | |
| 148 | // ParseIndex parses an index from a json string. |
| 149 | // Leave platform empty to use current platform. |