PersistConfig mirrors the local configuration file to PostgreSQL.
(ctx context.Context)
| 395 | |
| 396 | // PersistConfig mirrors the local configuration file to PostgreSQL. |
| 397 | func (s *PostgresStore) PersistConfig(ctx context.Context) error { |
| 398 | s.mu.Lock() |
| 399 | defer s.mu.Unlock() |
| 400 | |
| 401 | data, err := os.ReadFile(s.configPath) |
| 402 | if err != nil { |
| 403 | if errors.Is(err, fs.ErrNotExist) { |
| 404 | return s.deleteConfigRecord(ctx) |
| 405 | } |
| 406 | return fmt.Errorf("postgres store: read config file: %w", err) |
| 407 | } |
| 408 | return s.persistConfig(ctx, data) |
| 409 | } |
| 410 | |
| 411 | // syncConfigFromDatabase writes the database-stored config to disk or seeds the database from template. |
| 412 | func (s *PostgresStore) syncConfigFromDatabase(ctx context.Context, exampleConfigPath string) error { |
nothing calls this directly
no test coverage detected