chore: rework solution

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2024-11-28 13:49:53 +01:00
parent 4bdfcf05ba
commit 35d6263803
3 changed files with 36 additions and 17 deletions
+23 -10
View File
@@ -377,23 +377,29 @@ export interface Config {
/** Database connection configuration, select base database type using the `client` field */
database: {
/** Default database client to use */
client: 'better-sqlite3' | 'sqlite3' | 'pg' | 'pg+google-cloudsql';
client: 'better-sqlite3' | 'sqlite3' | 'pg';
/**
* Base database connection string, or object with individual connection properties
* @visibility secret
*/
connection:
| string
| {
/**
* The specific config for cloudsql connections
*/
type: 'cloudsql';
/**
* The instance connection name for the cloudsql instance, e.g. `project:region:instance`
*/
instance: string;
}
| {
/**
* Password that belongs to the client User
* @visibility secret
*/
password?: string;
/**
* The instance connection name to use for google cloudsql connector. Should be format of `project:region:instance`
*/
instance?: string;
/**
* Other connection settings
*/
@@ -440,28 +446,35 @@ export interface Config {
plugin?: {
[pluginId: string]: {
/** Database client override */
client?: 'better-sqlite3' | 'sqlite3' | 'pg' | 'pg+google-cloudsql';
client?: 'better-sqlite3' | 'sqlite3' | 'pg';
/**
* Database connection string or Knex object override
* @visibility secret
*/
connection?:
| string
| {
/**
* The specific config for cloudsql connections
*/
type: 'cloudsql';
/**
* The instance connection name for the cloudsql instance, e.g. `project:region:instance`
*/
instance: string;
}
| {
/**
* Password that belongs to the client User
* @visibility secret
*/
password?: string;
/**
* The instance connection name to use for google cloudsql connector. Should be format of `project:region:instance`
*/
instance?: string;
/**
* Other connection settings
*/
[key: string]: unknown;
};
/**
* Whether to ensure the given database exists by creating it if it does not.
* Defaults to base config if unspecified.