PersistAuthFiles stores the provided auth file changes in PostgreSQL.
(ctx context.Context, _ string, paths ...string)
| 361 | |
| 362 | // PersistAuthFiles stores the provided auth file changes in PostgreSQL. |
| 363 | func (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. |
| 397 | func (s *PostgresStore) PersistConfig(ctx context.Context) error { |
nothing calls this directly
no test coverage detected