-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 2.6.2 - Cluster DB, abstract db, more translations (#195)
* E2E tests (#163) * Add E2E tests add kosh remove indiviual prod envs * add test for random and search ops * update script key * Updates for security vunerablities (#165) * Add local db running in docker-container (#169) * Add lcoal db running docker-container * update start strict * update docker-compose * update readme and arrange package.json script alphabetically * fix typo * add await for container to be ready and start script DB port * Update README.md * More transl srcs (#182) * fix issue with blank visraam #181 add manmohan singh to punjabi fix some docker script problems * Automatically serve any available punjabi translations * remove lodash * resolving issues from sttm-api repo * fix for ceremonies * remove lodash * Delete package-lock.json * Add translation sources * Failover db (#186) * Adds failover to database connection #179 * Dbname to process (#189) * Move db configs to process env * increment version * Review fixes - change to array and add examples * remove extra truthiness * add package-lock.json back * Update maria db connector (#192) * Use ordered cluster, keep idle connections, compress db stream (#194) Co-authored-by: tsingh777 <[email protected]> Co-authored-by: Aman Singh <[email protected]>
- Loading branch information
1 parent
954c498
commit 82336a5
Showing
6 changed files
with
10,314 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,76 @@ | ||
module.exports = { | ||
mysql: { | ||
/** | ||
* Expects process-dev.json or process.json (or run local) | ||
* | ||
* @example | ||
* | ||
* { | ||
* "name" : "banidb", | ||
* "script" : "app.js", | ||
* "env": { | ||
* "NODE_ENV": "development|production", | ||
* "DB_USER": "", | ||
* "DB_PASSWORD": "", | ||
* "DB_POOL_SIZE": 5, | ||
* "DB_NODES": [ | ||
* { | ||
* "host": "localhost", | ||
* "port": 3306, | ||
* "isPrimary": true, | ||
* }, | ||
* { | ||
* "host": "dba.contoso.net", | ||
* }, | ||
* { | ||
* "host": "dbb.contoso.net", | ||
* }, | ||
* ], | ||
* }, | ||
* "error_file": "err.log", | ||
* "out_file": "out.log", | ||
* "log_date_format": "YYYY-MM-DD HH:mm:ss Z" | ||
* } | ||
*/ | ||
|
||
const metadata = { | ||
user: process.env.DB_USER || 'root', | ||
password: process.env.DB_PASSWORD || 'root', | ||
database: process.env.NODE_ENV === 'development' ? 'khajana_dev_khajana' : 'khajana_khajana', | ||
dateStrings: true, | ||
compress: true, | ||
acquireTimeout: 6000, | ||
connectionLimit: process.env.DB_POOL_SIZE, | ||
}; | ||
const standbyMetadata = { | ||
minimumIdle: 2, | ||
}; | ||
|
||
// everything below is to pull from process.json | ||
const configArry = []; | ||
|
||
// if npm run local, then just define what cli gives, otherwise use process.json | ||
if (!!process.env.DB_NODES) { | ||
const dbs = JSON.parse(process.env.DB_NODES); | ||
dbs.forEach(db => { | ||
const thisObj = { | ||
...metadata, | ||
host: db.host, | ||
port: db.port || 3306, | ||
}; | ||
if (!!db.isPrimary) { | ||
configArry.push(thisObj); | ||
} else { | ||
configArry.push({ | ||
...thisObj, | ||
...standbyMetadata, | ||
}); | ||
} | ||
}); | ||
} else { | ||
configArry.push({ | ||
...metadata, | ||
host: process.env.DB_HOST || 'localhost', | ||
port: process.env.DB_PORT || 3306, | ||
user: process.env.DB_USER || 'root', | ||
password: process.env.DB_PASSWORD || 'root', | ||
database: process.env.NODE_ENV === 'development' ? 'khajana_dev_khajana' : 'khajana_khajana', | ||
dateStrings: true, | ||
connectionLimit: process.env.DB_POOL_SIZE, | ||
}, | ||
}; | ||
}); | ||
} | ||
|
||
module.exports = configArry; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.