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
f53fa372
Commit
f53fa372
authored
Nov 02, 2021
by
wty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重写阿波罗配置获取
parent
bcb426bc
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
15 deletions
+43
-15
dui123.iml
.idea/dui123.iml
+1
-0
dev.json
config/dev.json
+2
-1
getConfig.js
config/getConfig.js
+1
-1
prod.json
config/prod.json
+1
-0
test.json
config/test.json
+1
-0
SQLPool.js
server/SQLPool.js
+19
-11
package.json
server/package.json
+1
-0
yarn.lock
server/yarn.lock
+17
-2
No files found.
.idea/dui123.iml
View file @
f53fa372
...
...
@@ -15,6 +15,7 @@
<content
url=
"file://$MODULE_DIR$/node_modules"
/>
<content
url=
"file://$MODULE_DIR$/node_modules/@types"
/>
<content
url=
"file://$MODULE_DIR$/server/node_modules"
/>
<content
url=
"file://$MODULE_DIR$/server/node_modules/@tuia/apollo"
/>
<content
url=
"file://$MODULE_DIR$/server/node_modules/@types"
/>
<content
url=
"file://$MODULE_DIR$/server/node_modules/sso-oauth2"
/>
<orderEntry
type=
"inheritedJdk"
/>
...
...
config/dev.json
View file @
f53fa372
{
"PORT"
:
"3000"
,
"API_HOST"
:
"//dui123.duibadev.com.cn"
,
"env"
:
"dev"
,
"SSO"
:
{
"ssourl"
:
"http://sso.duibadev.com.cn"
,
"systemId"
:
491
,
...
...
@@ -8,5 +9,5 @@
"systemName"
:
"duiba-aurora-node"
,
"profiles"
:
"dev"
},
"
remote_config_url"
:
"http://configserver.duiba
.com/dui123/dev?accessKey=5d0cb61fe5ef40afa49bc22b64f9ede1"
"
secret"
:
"http://configserver.dui88
.com/dui123/dev?accessKey=5d0cb61fe5ef40afa49bc22b64f9ede1"
}
config/getConfig.js
View file @
f53fa372
const
env
=
'
test
'
const
env
=
'
dev
'
const
getConfig
=
()
=>
{
switch
(
env
){
...
...
config/prod.json
View file @
f53fa372
{
"PORT"
:
"3000"
,
"API_HOST"
:
"//dui123.duiba.com.cn"
,
"env"
:
"prod"
,
"SSO"
:
{
"ssourl"
:
"http://sso.duiba.com.cn"
,
"systemId"
:
491
,
...
...
config/test.json
View file @
f53fa372
{
"PORT"
:
"3000"
,
"API_HOST"
:
"//dui123.duibatest.com.cn"
,
"env"
:
"test"
,
"SSO"
:
{
"ssourl"
:
"http://sso.duibatest.com.cn"
,
"systemId"
:
491
,
...
...
server/SQLPool.js
View file @
f53fa372
const
MYSQL
=
require
(
'mysql'
)
const
request
=
require
(
'request'
)
const
config
=
require
(
'../config/getConfig'
)()
const
apollo
=
require
(
'@tuia/apollo'
)
//应用数据库
console
.
info
(
'CONFIG:'
,
config
)
const
getMysql
=
new
Promise
((
resolve
)
=>
{
request
(
config
[
'remote_config_url'
],{},(
error
,
request
,
body
)
=>
{
if
(
error
)
console
.
error
(
'MySql.js :'
,
error
)
console
.
info
(
'apolloConfig:'
,
body
)
const
data
=
JSON
.
parse
(
body
)
const
source
=
data
[
'propertySources'
][
0
][
'source'
]
console
.
info
(
'CONFIG:'
,
config
)
const
getApollo
=
async
()
=>
{
const
config
=
await
apollo
.
getApolloConfig
({
systemName
:
'dui123'
,
env
:
config
.
env
,
accessKey
:
config
.
secret
})
console
.
info
(
config
)
const
sourcesArray
=
config
.
propertySources
.
map
(
v
=>
v
.
source
);
const
sources
=
Object
.
assign
({},...
sourcesArray
)
return
sources
}
const
getMysql
=
new
Promise
(
async
(
resolve
)
=>
{
const
source
=
await
getApollo
()
const
username
=
source
[
'apollo.mysql.duiba_web_tool.username'
]
const
password
=
source
[
'apollo.mysql.duiba_web_tool.password'
]
const
database
=
source
[
'apollo.mysql.duiba_web_tool.database'
]
...
...
@@ -24,9 +33,8 @@ const getMysql = new Promise((resolve)=>{
'connectionLimit'
:
1000
})
// console.info('MysqlConfig:',Mysql.config)
console
.
info
(
'OBJMysql'
,
Mysql
)
console
.
info
(
'OBJMysql'
,
Mysql
)
resolve
(
Mysql
)
})
})
// 本地数据库
...
...
server/package.json
View file @
f53fa372
...
...
@@ -7,6 +7,7 @@
"start"
:
"node app.js"
},
"dependencies"
:
{
"@tuia/apollo"
:
"^0.1.0"
,
"@types/express"
:
"^4.17.13"
,
"@types/mysql"
:
"^2.15.19"
,
"axios"
:
"^0.18.0"
,
...
...
server/yarn.lock
View file @
f53fa372
...
...
@@ -107,6 +107,14 @@
resolved "http://npm.dui88.com:80/@tootallnate%2fonce/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
integrity sha1-zLkURTYBeaBOf+av94wA/8Hur4I=
"@tuia/apollo@^0.1.0":
version "0.1.0"
resolved "http://npm.dui88.com:80/@tuia%2fapollo/-/apollo-0.1.0.tgz#b1ea17e7f498c0b1325437471285e7156786d5fa"
integrity sha512-WVsGr2VQLGDxmO86tgGndKHDBodLFLFv1hXX+E95m2fFu/NNbqAqE+0XZL/QKn+d+TKb6Fmv9YsCJ/O1/HaYDg==
dependencies:
axios "^0.20.0"
lodash "^4.17.20"
"@types/body-parser@*":
version "1.19.1"
resolved "http://npm.dui88.com:80/@types%2fbody-parser/-/body-parser-1.19.1.tgz#0c0174c42a7d017b818303d4b5d969cb0b75929c"
...
...
@@ -600,6 +608,13 @@ axios@^0.19.0:
dependencies:
follow-redirects "1.5.10"
axios@^0.20.0:
version "0.20.0"
resolved "http://npm.dui88.com:80/axios/-/axios-0.20.0.tgz#057ba30f04884694993a8cd07fa394cff11c50bd"
integrity sha1-BXujDwSIRpSZOozQf6OUz/EcUL0=
dependencies:
follow-redirects "^1.10.0"
axios@^0.21.0:
version "0.21.4"
resolved "http://npm.dui88.com:80/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575"
...
...
@@ -2189,7 +2204,7 @@ follow-redirects@1.5.10:
dependencies:
debug "=3.1.0"
follow-redirects@^1.14.0:
follow-redirects@^1.1
0.0, follow-redirects@^1.1
4.0:
version "1.14.4"
resolved "http://npm.dui88.com:80/follow-redirects/-/follow-redirects-1.14.4.tgz#838fdf48a8bbdd79e52ee51fb1c94e3ed98b9379"
integrity sha1-g4/fSKi73XnlLuUfsclOPtmLk3k=
...
...
@@ -3085,7 +3100,7 @@ locate-path@^5.0.0:
dependencies:
p-locate "^4.1.0"
lodash@^4.13.1, lodash@^4.17.14, lodash@^4.17.4:
lodash@^4.13.1, lodash@^4.17.14, lodash@^4.17.
20, lodash@^4.17.
4:
version "4.17.21"
resolved "http://npm.dui88.com:80/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw=
...
...
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