aperturedb: add yaml struct tags to fix config file key mismatches#235
Open
maml wants to merge 1 commit into
Open
aperturedb: add yaml struct tags to fix config file key mismatches#235maml wants to merge 1 commit into
maml wants to merge 1 commit into
Conversation
Aperture parses its config file with goccy/go-yaml, which falls back to the lowercased struct field name when no yaml tag is present. Two fields had a mismatch between their go-flags `long:` tag (which documents the YAML key in sample-conf.yaml) and the goccy/go-yaml fallback name derived from the field name: SqliteConfig.DatabaseFileName long:"dbfile" fallback: "databasefilename" PostgresConfig.MaxOpenConnections long:"maxconnections" fallback: "maxopenconnections" In both cases the documented yaml key in sample-conf.yaml matches the long: tag, not the fallback. So a user who follows the documentation and sets sqlite.dbfile or postgres.maxconnections in their config file has those values silently ignored. For sqlite, this causes Aperture to resolve DatabaseFileName to the hardcoded defaultSqliteDatabasePath (~/Library/Application Support/Aperture/aperture.db on macOS), a directory that typically does not exist, and SQLite fails to open the DB with "unable to open database file: out of memory (14)" (CANTOPEN). Fix: add yaml: tags matching the existing long: tags so goccy/go-yaml reads the documented keys. Also add yaml:"skipmigrations" to both SkipMigrations fields for consistency.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds missing
yaml:struct tags toSqliteConfigandPostgresConfigso that YAML config file keys are correctly mapped when aperture is configured viaaperture.yaml.Problem
goccy/go-yaml(used inaperture.go) falls back to the lowercased field name when noyaml:tag is present. This caused silent mismatches:SqliteConfig.DatabaseFileNamedbfiledatabasefilenamedbfileSqliteConfig.SkipMigrationsskipmigrationsskipmigrationsskipmigrationsPostgresConfig.MaxOpenConnectionsmaxconnectionsmaxopenconnectionsmaxconnectionsPostgresConfig.SkipMigrationsskipmigrationsskipmigrationsskipmigrationsPostgresConfig.RequireSSLrequiresslrequiresslrequireSSLFix
Added
yaml:tags matching the documented config keys:SqliteConfig.DatabaseFileName:yaml:"dbfile"PostgresConfig.MaxOpenConnections:yaml:"maxconnections"PostgresConfig.RequireSSL:yaml:"requireSSL"(matchessample-conf.yaml:168)PostgresConfig.SkipMigrationsandSqliteConfig.SkipMigrations:yaml:"skipmigrations"(no behaviour change, added for explicitness and rename safety)Test plan
dbfile: /path/to/dbin YAML; confirm SQLite opens correctly.maxconnections: 5; confirm pool size is respected.requireSSL: true; confirm TLS connection is required.