Commit 60c96dd7 authored by wty's avatar wty

更改连接池

parent f81f9bd4
...@@ -3,27 +3,37 @@ const MYSQL = require('mysql') ...@@ -3,27 +3,37 @@ const MYSQL = require('mysql')
const config = require('../config/dev.json') const config = require('../config/dev.json')
const request = require('request') const request = require('request')
request(config['remote_config_url'],{},(error, request, body)=>{ // request(config['remote_config_url'],{},(error, request, body)=>{
const data = JSON.parse(body) // const data = JSON.parse(body)
const source = data['propertySources'][0]['source'] // const source = data['propertySources'][0]['source']
const username = source['apollo.mysql.duiba_web_tool.username'] // const username = source['apollo.mysql.duiba_web_tool.username']
const password = source['apollo.mysql.duiba_web_tool.password'] // const password = source['apollo.mysql.duiba_web_tool.password']
const database = source['apollo.mysql.duiba_web_tool.database'] // const database = source['apollo.mysql.duiba_web_tool.database']
const host = source['apollo.mysql.duiba_web_tool.url'].split(':')[0] // const host = source['apollo.mysql.duiba_web_tool.url'].split(':')[0]
const port = source['apollo.mysql.duiba_web_tool.url'].split(':')[1] // const port = source['apollo.mysql.duiba_web_tool.url'].split(':')[1]
const Mysql = MYSQL.createPool({ // const Mysql = MYSQL.createPool({
'host': host, // 'host': host,
'port': port, // 'port': port,
'user': username, // 'user': username,
'password': password, // 'password': password,
'database': database, // 'database': database,
'connectionLimit': 1000 // 'connectionLimit': 1000
}) // })
console.info(Mysql.config) // console.info('MysqlConfig:',Mysql.config)
console.info(Mysql) // console.info('OBJMysql',Mysql)
module.exports = Mysql // module.exports = Mysql
// })
const Mysql = MYSQL.createPool({
'host': 'rm-bp1jglyqbhi8qwf0a.mysql.rds.aliyuncs.com',
'port': 3306,
'user': "duiba_dev",
'password': "dbseccode3qTecHjXZCTSNmptANeMVnAURVVzgSoj",
'database': "duiba_web_tool",
'connectionLimit': 1000
}) })
console.info('MysqlConfig:', Mysql.config)
console.info('OBJMysql', Mysql)
module.exports = Mysql
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment