| 35 | } |
| 36 | |
| 37 | func (s *tlsStore) getData(name, endpointName, filename string) ([]byte, error) { |
| 38 | data, err := os.ReadFile(filepath.Join(s.endpointDir(name, endpointName), filename)) |
| 39 | if err != nil { |
| 40 | if os.IsNotExist(err) { |
| 41 | return nil, notFound(fmt.Errorf("TLS data for %s/%s/%s does not exist", name, endpointName, filename)) |
| 42 | } |
| 43 | return nil, fmt.Errorf("failed to read TLS data for endpoint %s: %w", endpointName, err) |
| 44 | } |
| 45 | return data, nil |
| 46 | } |
| 47 | |
| 48 | // remove deletes all TLS data for the given context. |
| 49 | func (s *tlsStore) remove(name string) error { |