Skip to content

Conversation

@ivanauth
Copy link
Contributor

@ivanauth ivanauth commented Oct 10, 2025

Fixes #2218

Summary

Adds individual connection parameter flags as an alternative to --datastore-conn-uri for easier configuration from Kubernetes secrets or environment variables.

New Flags

  • --datastore-host: database host
  • --datastore-port: database port (defaults: 5432 for Postgres/CRDB, 3306 for MySQL)
  • --datastore-username: database username
  • --datastore-password: database password
  • --datastore-database: database name

Features

  • Auto-builds connection URI from granular params when --datastore-conn-uri is not provided
  • Supports Postgres, CockroachDB, and MySQL
  • Full backward compatibility with existing --datastore-conn-uri flag
  • URI takes precedence if both provided

Example Usage

spicedb serve \
  --datastore-engine=postgres \
  --datastore-host=localhost \
  --datastore-port=5432 \
  --datastore-username=spicedb \
  --datastore-password=secret \
  --datastore-database=spicedb

Add individual connection parameter flags as an alternative to
--datastore-conn-uri for easier configuration from Kubernetes secrets
or environment variables.

New flags: --datastore-host, --datastore-port, --datastore-username,
--datastore-password, --datastore-database

- Auto-builds connection URI from granular params when URI not provided
- Supports Postgres, CockroachDB, and MySQL
- Sets default ports (5432 for Postgres/CRDB, 3306 for MySQL)
- Full backward compatibility with existing --datastore-conn-uri flag
- Comprehensive test coverage

Fixes authzed#2218
@ivanauth ivanauth requested a review from a team as a code owner October 10, 2025 14:25
@github-actions github-actions bot added area/cli Affects the command line area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels Oct 10, 2025
@codecov
Copy link

codecov bot commented Oct 10, 2025

Codecov Report

❌ Patch coverage is 89.36170% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.61%. Comparing base (d01abad) to head (2f8ef15).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
pkg/cmd/datastore/datastore.go 89.37% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2604      +/-   ##
==========================================
+ Coverage   77.59%   77.61%   +0.02%     
==========================================
  Files         442      442              
  Lines       54871    54919      +48     
==========================================
+ Hits        42573    42621      +48     
- Misses       9628     9630       +2     
+ Partials     2670     2668       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli Affects the command line area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Granular Flags/Vars for Datastore Connections

1 participant