New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI Starter create-directus-project: Allow for specifying options
param in db connection
#16066
Comments
options
param in db connection
Your current solution (thanks for that btw! :) ) is to add the |
Hi @rijkvanzanten. No worries, thanks for the feedback. Yes, I agree with everything you said. Asking for a connection string would definitely be the most ergonomic solution. Most DB services, including CRDB as you noted, provide them. That was my initial thinking too, but I chose to go the low impact route with this PR to minimize changes to the codebase 😅. I'll take another shot at it with the aim of replacing all flags in favor of asking for the connection string as you suggested. I'll keep you posted :) |
Sounds good, thanks! 💟 |
Linear: ENG-158 |
When quickstarting a new project with:
I would like to connect to a CockroachDB Serverless cluster which requires a specific cluster to be specified in the options parameter of the connection string:
e.g.
postgresql://<db-user>:<db-password>@free-tier8.aws-ap-southeast-1.cockroachlabs.cloud:26257/defaultdb?sslmode=verify-full&options=--cluster%3D<cluster-identifier>
The problem is that the CLI only accepts db connection parameters and not a connection string, and the parameters that are asked for don't include an
options
string.Proposed Solution
options?: string
property:directus/api/src/cli/utils/create-db-connection.ts
Lines 5 to 14 in cbe1e7f
options
property here exposingKnex.PgConnectionConfig
:directus/api/src/cli/utils/create-db-connection.ts
Lines 38 to 41 in cbe1e7f
options
string if the dbclient ispg
orcockroachdb
here: https://github.com/directus/directus/blob/cbe1e7fbc69c8e9bd02254e9ed6efc35ba6468ef/api/src/cli/commands/init/questions.tsWhy?
This will make it alot easier for developers new to Directus to bootstrap a new project, especially those wanting to connect to a multi-tennant, serverless database offering like CockroachDB Serverless.
Alternative Solutions
DB_CONNECTION_STRING
env var before runningpnpm directus bootstrap
: https://docs.directus.io/self-hosted/installation/manual.htmlOriginally posted by @jpizzle34 in #15848
The text was updated successfully, but these errors were encountered: