MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / PersistConfig

Method PersistConfig

internal/store/postgresstore.go:397–409  ·  view source on GitHub ↗

PersistConfig mirrors the local configuration file to PostgreSQL.

(ctx context.Context)

Source from the content-addressed store, hash-verified

395
396// PersistConfig mirrors the local configuration file to PostgreSQL.
397func (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.
412func (s *PostgresStore) syncConfigFromDatabase(ctx context.Context, exampleConfigPath string) error {

Callers

nothing calls this directly

Calls 2

deleteConfigRecordMethod · 0.95
persistConfigMethod · 0.95

Tested by

no test coverage detected