spicedb icon indicating copy to clipboard operation
spicedb copied to clipboard

feat: add granular datastore connection flags

Open ivanauth opened this issue 4 months ago • 1 comments

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

ivanauth avatar Oct 10 '25 14:10 ivanauth

Codecov Report

:x: Patch coverage is 85.71429% with 6 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 77.57%. Comparing base (dad989c) to head (bfd967f). :warning: Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
pkg/cmd/datastore/datastore.go 85.72% 5 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2604      +/-   ##
==========================================
+ Coverage   77.07%   77.57%   +0.51%     
==========================================
  Files         466      471       +5     
  Lines       49199    49606     +407     
==========================================
+ Hits        37914    38476     +562     
+ Misses       8502     8279     -223     
- Partials     2783     2851      +68     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Oct 10 '25 14:10 codecov[bot]