diff --git a/docs/dev_environment.md b/docs/dev_environment.md --- a/docs/dev_environment.md +++ b/docs/dev_environment.md @@ -416,8 +416,7 @@ "host": "127.0.0.1", "user": "comm", "password": "password", - "database": "comm", - "dbType": "mariadb10.8" + "database": "comm" } ``` diff --git a/keyserver/src/database/database.js b/keyserver/src/database/database.js --- a/keyserver/src/database/database.js +++ b/keyserver/src/database/database.js @@ -22,7 +22,7 @@ if (migrationConnection) { return migrationConnection; } - const { dbType, ...dbConfig } = await getDBConfig(); + const { ...dbConfig } = await getDBConfig(); const options: ConnectionOptions = dbConfig; migrationConnection = await mysqlPromise.createConnection(options); return migrationConnection; @@ -34,7 +34,7 @@ return pool; } const scriptContext = getScriptContext(); - const { dbType, ...dbConfig } = await getDBConfig(); + const { ...dbConfig } = await getDBConfig(); const options: PoolOptions = { ...dbConfig, connectionLimit, @@ -187,7 +187,7 @@ } async function getMultipleStatementsConnection() { - const { dbType, ...dbConfig } = await getDBConfig(); + const { ...dbConfig } = await getDBConfig(); const options: ConnectionOptions = { ...dbConfig, multipleStatements: true, diff --git a/keyserver/src/database/db-config.js b/keyserver/src/database/db-config.js --- a/keyserver/src/database/db-config.js +++ b/keyserver/src/database/db-config.js @@ -4,38 +4,15 @@ import { getCommConfig } from 'lib/utils/comm-config.js'; -type DBType = 'mariadb10.8'; export type DBConfig = { +host: string, +user: string, +password: string, +database: string, - +dbType: DBType, }; -function assertValidDBType(dbType: ?string): DBType { - invariant( - dbType, - 'dbType not specified in DB config. Following the MySQL deprecation this ' + - 'is a required parameter. Please follow this Gist to migrate to ' + - 'MariaDB: ' + - 'https://gist.github.com/Ashoat/3a5ded2549db082c5516606f3c3c5da5', - ); - invariant( - dbType !== 'mysql5.7', - 'We no longer support MySQL. Please follow this Gist to migrate to ' + - 'MariaDB: ' + - 'https://gist.github.com/Ashoat/3a5ded2549db082c5516606f3c3c5da5', - ); - invariant(dbType === 'mariadb10.8', `${dbType} is not a valid dbType`); - return dbType; -} - let dbConfig; async function getDBConfig(): Promise { - if (dbConfig !== undefined) { - return dbConfig; - } if ( process.env.COMM_DATABASE_DATABASE && process.env.COMM_DATABASE_USER && @@ -46,7 +23,6 @@ user: process.env.COMM_DATABASE_USER, password: process.env.COMM_DATABASE_PASSWORD, database: process.env.COMM_DATABASE_DATABASE, - dbType: assertValidDBType(process.env.COMM_DATABASE_TYPE), }; } else { const importedDBConfig = await getCommConfig({ @@ -54,17 +30,12 @@ name: 'db_config', }); invariant(importedDBConfig, 'DB config missing'); + dbConfig = { ...importedDBConfig, - dbType: assertValidDBType(importedDBConfig.dbType), }; } return dbConfig; } -async function getDBType(): Promise { - const config = await getDBConfig(); - return config.dbType; -} - -export { getDBConfig, getDBType }; +export { getDBConfig }; diff --git a/nix/mariadb-up-mac.nix b/nix/mariadb-up-mac.nix --- a/nix/mariadb-up-mac.nix +++ b/nix/mariadb-up-mac.nix @@ -44,7 +44,6 @@ "user": "comm", "password": "PASS", "database": "comm", - "dbType": "mariadb${mariadb-version}" } ''; };