Skip to content

Matt#5

Merged
pnwmatt merged 21 commits intomainfrom
matt
Oct 2, 2025
Merged

Matt#5
pnwmatt merged 21 commits intomainfrom
matt

Conversation

@pnwmatt
Copy link
Contributor

@pnwmatt pnwmatt commented Sep 25, 2025

This pull request introduces a new authentication and configuration management system for the sqlrsync client, focusing on supporting local configuration files, environment variables, and interactive prompts for credentials. The changes modularize and centralize authentication logic, improve configuration file handling, and provide a clear interface for resolving and storing authentication information.

Key changes:

Authentication and Resolution System

  • Added a new auth package with resolver.go, implementing a Resolver type that centralizes all logic for resolving authentication credentials from environment variables, config files, or user prompts. It supports both "push" and "pull" operations and can save authentication results to local config files or -sqlrsync files. (client/auth/resolver.go)
  • The Resolver supports environment variables (SQLRSYNC_AUTH_TOKEN, SQLRSYNC_ADMIN_KEY), explicit keys, and config file lookup, and will prompt the user for an admin key if needed. (client/auth/resolver.go)

Configuration File Management

  • Added config.go to the auth package, which manages reading and writing of defaults.toml and local-secrets.toml in the user's config directory, as well as the -sqlrsync files used for pull/subscribe operations. It includes helpers for safely updating, searching, and removing database entries. (client/auth/config.go)
  • Ensured that sensitive files like local-secrets.toml are written with secure permissions (0600). (client/auth/config.go)

Code Quality and Consistency

  • Fixed minor formatting and consistency issues in the legacy config.go (now largely replaced), such as spacing in function definitions and updating the help URL in generated -sqlrsync files. (client/config.go) [1] [2]

References:
[1] [2] [3] [4]

@pnwmatt pnwmatt merged commit 4ccbcdd into main Oct 2, 2025
3 checks passed
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