Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
Dui123
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
王天宇
Dui123
Commits
60c96dd7
Commit
60c96dd7
authored
Oct 21, 2021
by
wty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改连接池
parent
f81f9bd4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
20 deletions
+30
-20
SQLPool.js
server/SQLPool.js
+30
-20
No files found.
server/SQLPool.js
View file @
60c96dd7
...
@@ -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
// })
// console.info('MysqlConfig:',Mysql.config)
// console.info('OBJMysql',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
'connectionLimit'
:
1000
})
console
.
info
(
Mysql
.
config
)
console
.
info
(
Mysql
)
module
.
exports
=
Mysql
})
})
console
.
info
(
'MysqlConfig:'
,
Mysql
.
config
)
console
.
info
(
'OBJMysql'
,
Mysql
)
module
.
exports
=
Mysql
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment