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

Method PersistAuthFiles

internal/store/postgresstore.go:363–394  ·  view source on GitHub ↗

PersistAuthFiles stores the provided auth file changes in PostgreSQL.

(ctx context.Context, _ string, paths ...string)

Source from the content-addressed store, hash-verified

361
362// PersistAuthFiles stores the provided auth file changes in PostgreSQL.
363func (s *PostgresStore) PersistAuthFiles(ctx context.Context, _ string, paths ...string) error {
364 if len(paths) == 0 {
365 return nil
366 }
367 s.mu.Lock()
368 defer s.mu.Unlock()
369
370 for _, p := range paths {
371 trimmed := strings.TrimSpace(p)
372 if trimmed == "" {
373 continue
374 }
375 relID, err := s.relativeAuthID(trimmed)
376 if err != nil {
377 // Attempt to resolve absolute path under authDir.
378 abs := trimmed
379 if !filepath.IsAbs(abs) {
380 abs = filepath.Join(s.authDir, trimmed)
381 }
382 relID, err = s.relativeAuthID(abs)
383 if err != nil {
384 log.WithError(err).Warnf("postgres store: ignoring auth path %s", trimmed)
385 continue
386 }
387 trimmed = abs
388 }
389 if err = s.syncAuthFile(ctx, relID, trimmed); err != nil {
390 return err
391 }
392 }
393 return nil
394}
395
396// PersistConfig mirrors the local configuration file to PostgreSQL.
397func (s *PostgresStore) PersistConfig(ctx context.Context) error {

Callers

nothing calls this directly

Calls 2

relativeAuthIDMethod · 0.95
syncAuthFileMethod · 0.95

Tested by

no test coverage detected