Skip to content

Key mgmt refactor, pull implementation, -sqlrsync improvements#4

Merged
pnwmatt merged 11 commits intomainfrom
matt
Sep 10, 2025
Merged

Key mgmt refactor, pull implementation, -sqlrsync improvements#4
pnwmatt merged 11 commits intomainfrom
matt

Conversation

@pnwmatt
Copy link
Contributor

@pnwmatt pnwmatt commented Sep 6, 2025

This pull request refactors and improves the configuration, authentication, and synchronization logic for the SQLRsync client, with a strong focus on making key management more explicit, updating the configuration file structure, and improving the handling of push/pull operations. It also cleans up legacy logic, improves error handling, and enhances the -sqlrsync shareable config file process.

Configuration and Key Management Refactor:

  • Refactored the LocalSecretsConfig and SQLRsyncDatabase structs in client/config.go to use more descriptive field names (e.g., LocalPath, PushKey, CustomerSuppliedEncryptionKey) and removed the nested Local struct, making key and replica management more explicit and easier to maintain. (client/config.go client/config.goR14-R42)
  • Updated related methods (FindDatabaseByPath, UpdateOrAddDatabase, RemoveDatabase) to use the new field names, ensuring consistency throughout the codebase. (client/config.go [1] [2] [3]

Push/Pull Authentication and CLI Improvements:

  • Replaced the generic authToken with explicit pullKey and pushKey variables and CLI flags, and improved prompts and messages for key entry, making it clearer for users when and why keys are required. (client/main.go [1] [2] [3] [4]
  • Added replicaID as a CLI flag and propagated it through the push/pull logic for better control over replica management. (client/main.go client/main.goL611-R583)

-sqlrsync File Generation and Usage:

  • Enhanced the logic for generating and updating the -sqlrsync shareable config file to include additional metadata (e.g., replicaID, server), and improved the detection of when a new file needs to be created. (client/config.go [1] [2] client/main.go [3] [4] [5]
  • Modified the logic to handle versioning and absolute paths more robustly when pulling and pushing databases, reducing user error and improving UX. (client/main.go [1] [2] [3]

Error Handling and Logging:

  • Improved error handling and logging throughout the push/pull flows, including clearer messages and more robust EOF handling in the bridge and wrapper layers. (bridge/cgo_bridge.go [1] bridge/sqlite_rsync_wrapper.c [2] client/main.go [3] [4]

Protocol and Internal Constants:

  • Updated protocol constants and internal logic for sending configuration commands instead of just read key requests, aligning the client with new server-side expectations. (client/remote/client.go [1] client/main.go [2]

These changes collectively make authentication and configuration handling more robust, user-friendly, and maintainable, while also paving the way for future enhancements to the SQLRsync client.

@pnwmatt
Copy link
Contributor Author

pnwmatt commented Sep 10, 2025

Reviewed

@pnwmatt pnwmatt merged commit 02ca2ca into main Sep 10, 2025
3 checks passed
pnwmatt added a commit that referenced this pull request Sep 25, 2025
Key mgmt refactor, pull implementation, -sqlrsync improvements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant