Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3402998
D12021.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D12021.diff
View Options
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/flow-typed/npm/mysql_v2.x.x.js b/keyserver/flow-typed/npm/mysql_v2.x.x.js
--- a/keyserver/flow-typed/npm/mysql_v2.x.x.js
+++ b/keyserver/flow-typed/npm/mysql_v2.x.x.js
@@ -19,29 +19,29 @@
}
declare type ConnectionOptions = {
- host?: string,
- port?: number,
- localAddress?: string,
- socketPath?: string,
- user: string,
- password: string,
- database?: string,
- charset?: string,
- timezone?: string,
- connectTimeout?: number,
- stringifyObjects?: boolean,
- insecureAuth?: boolean,
- typeCast?: boolean | ((field: TypeCastField, next: () => mixed) => any),
- queryFormat?: (query: string, values: ?mixed, timezone: string) => string,
- supportBigNumbers?: boolean,
- bigNumberStrings?: boolean,
- dateStrings?: boolean | Array<string>,
+ +host?: string,
+ +port?: number,
+ +localAddress?: string,
+ +socketPath?: string,
+ +user: string,
+ +password: string,
+ +database?: string,
+ +charset?: string,
+ +timezone?: string,
+ +connectTimeout?: number,
+ +stringifyObjects?: boolean,
+ +insecureAuth?: boolean,
+ +typeCast?: boolean | ((field: TypeCastField, next: () => mixed) => any),
+ +queryFormat?: (query: string, values: ?mixed, timezone: string) => string,
+ +supportBigNumbers?: boolean,
+ +bigNumberStrings?: boolean,
+ +dateStrings?: boolean | Array<string>,
// Array form contains ids of packets for logging
- debug?: boolean | Array<string>,
- trace?: boolean,
- multipleStatements?: boolean,
- flags?: string,
- ssl?: string | {...},
+ +debug?: boolean | Array<string>,
+ +trace?: boolean,
+ +multipleStatements?: boolean,
+ +flags?: string,
+ +ssl?: string | {...},
};
declare type QueryOptions = {
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<DBConfig> {
- 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<DBConfig>({
@@ -54,17 +30,10 @@
name: 'db_config',
});
invariant(importedDBConfig, 'DB config missing');
- dbConfig = {
- ...importedDBConfig,
- dbType: assertValidDBType(importedDBConfig.dbType),
- };
+
+ dbConfig = importedDBConfig;
}
return dbConfig;
}
-async function getDBType(): Promise<DBType> {
- 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}"
}
'';
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 3, 11:44 PM (6 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2612849
Default Alt Text
D12021.diff (5 KB)
Attached To
Mode
D12021: [keyserver][nix] remove dbType from db-config.js
Attached
Detach File
Event Timeline
Log In to Comment