Commit Graph

6 Commits

  • fix: prevent race condition in objectstore auth sync
    Remove os.RemoveAll() call in syncAuthFromBucket() that was causing
    a race condition with the file watcher.
    
    Problem:
    1. syncAuthFromBucket() wipes local auth directory with RemoveAll
    2. File watcher detects deletions and propagates them to remote store
    3. syncAuthFromBucket() then pulls from remote, but files are now gone
    
    Solution:
    Use incremental sync instead of delete-then-pull. Just ensure the
    directory exists and overwrite files as they're downloaded.
    This prevents the watcher from seeing spurious delete events.
  • feat(store): introduce GitTokenStore for token persistence via Git backend
    - Added `GitTokenStore` to handle token storage and metadata using Git as a backing storage.
    - Implemented methods for initialization, save, retrieval, listing, and deletion of auth files.
    - Updated `go.mod` and `go.sum` to include new dependencies for Git integration.
    - Integrated support for Git-backed configuration via `GitTokenStore`.
    - Updated server logic to clone, initialize, and manage configurations from Git repositories.
    - Added helper functions for verifying and synchronizing configuration files.
    - Improved error handling and contextual logging for Git operations.
    - Modified Dockerfile to include `config.example.yaml` for initial setup.
    - Added `gitCommitter` interface to handle Git-based commit and push operations.
    - Configured `Watcher` to detect and leverage Git-backed token stores.
    - Implemented `commitConfigAsync` and `commitAuthAsync` methods for asynchronous change synchronization.
    - Enhanced `GitTokenStore` with `CommitPaths` method to support selective file commits.