mirror of
https://github.com/mempool/mempool.git
synced 2025-01-19 05:34:03 +01:00
Cleanup MySQL unix socket code and add to sample config
This commit is contained in:
parent
465529b03f
commit
2023d36603
@ -44,6 +44,7 @@
|
||||
"ENABLED": true,
|
||||
"HOST": "127.0.0.1",
|
||||
"PORT": 3306,
|
||||
"SOCKET": "/var/run/mysql/mysql.sock",
|
||||
"DATABASE": "mempool",
|
||||
"USERNAME": "mempool",
|
||||
"PASSWORD": "mempool"
|
||||
|
@ -43,7 +43,7 @@ interface IConfig {
|
||||
DATABASE: {
|
||||
ENABLED: boolean;
|
||||
HOST: string,
|
||||
SOCKET: string | undefined,
|
||||
SOCKET: string,
|
||||
PORT: number;
|
||||
DATABASE: string;
|
||||
USERNAME: string;
|
||||
@ -122,7 +122,7 @@ const defaults: IConfig = {
|
||||
'DATABASE': {
|
||||
'ENABLED': true,
|
||||
'HOST': '127.0.0.1',
|
||||
'SOCKET': undefined,
|
||||
'SOCKET': '',
|
||||
'PORT': 3306,
|
||||
'DATABASE': 'mempool',
|
||||
'USERNAME': 'mempool',
|
||||
|
@ -15,10 +15,11 @@ export class DB {
|
||||
timezone: '+00:00',
|
||||
}
|
||||
|
||||
if (config.DATABASE.SOCKET && config.DATABASE.SOCKET != "")
|
||||
poolConfig.socketPath = config.DATABASE.SOCKET
|
||||
else
|
||||
poolConfig.host = config.DATABASE.HOST
|
||||
if (config.DATABASE.SOCKET !== "") {
|
||||
poolConfig.socketPath = config.DATABASE.SOCKET;
|
||||
} else {
|
||||
poolConfig.host = config.DATABASE.HOST;
|
||||
}
|
||||
|
||||
return poolConfig;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user