Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qa-deploy-utils
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
qa-deploy-utils
Commits
bf272002
Commit
bf272002
authored
Feb 28, 2018
by
tywldx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
f39ab8ad
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
125 additions
and
122 deletions
+125
-122
get_project_config_from_mongo.js
...ell_script/config_server/get_project_config_from_mongo.js
+125
-122
No files found.
qa_shell_script/config_server/get_project_config_from_mongo.js
View file @
bf272002
...
...
@@ -10,31 +10,29 @@ var param = {
name
:
""
,
attr
:
""
}
projects
=
String
(
execSync
(
`curl -s http://192.168.4.3:10088/config_server/get_project_config_from_db`
))
projects
=
JSON
.
parse
(
projects
)
projects
=
{}
_
projects
=
String
(
execSync
(
`curl -s http://192.168.4.3:10088/config_server/get_project_config_from_db`
))
_projects
=
JSON
.
parse
(
_
projects
)
// console.log(typeof(projects))
for
(
var
index
in
projects
)
{
switch
(
projects
[
index
][
'
type
'
])
{
for
(
let
pro
of
_projects
)
{
projects
[
pro
.
name
]
=
pro
;
switch
(
pro
[
'
type
'
])
{
case
"
java
"
:
java_projects
.
push
(
pro
jects
[
index
]
);
java_projects
.
push
(
pro
);
break
;
case
"
node
"
:
node_projects
.
push
(
pro
jects
[
index
]
);
node_projects
.
push
(
pro
);
break
;
case
"
ui
"
:
ui_projects
.
push
(
pro
jects
[
index
]
);
ui_projects
.
push
(
pro
);
break
;
case
"
python
"
:
python_projects
.
push
(
pro
jects
[
index
]
);
python_projects
.
push
(
pro
);
break
;
}
}
// // --java
// new pClass().init(1,true,"java", "7042", "xyqb-user2", "head_group", "xyqb-user2.log", "application.properties", "--worker 1 --currentWorker 1 -t -ts", "-Denv=dev -Didc=default -Dtech.localhost= -Dtest=true", "用户注册登录-V2-server", "", "mvn clean package -Ptest -Dmaven.test.skip=true", "");
var
temp
=
""
;
process
.
argv
.
forEach
(
function
(
val
,
index
,
array
)
{
...
...
@@ -60,8 +58,9 @@ function getListAttr(projects, attr) {
var
configFunction
=
function
()
{};
configFunction
.
prototype
=
{
getProjectAttr
:
function
(
pName
,
pAttr
)
{
for
(
var
index
in
projects
)
{
if
(
projects
[
index
][
'
name
'
]
==
pName
)
{
if
(
typeof
projects
[
pName
]
==
"
undefined
"
)
{
console
.
log
(
""
)
}
else
{
var
attrs
=
pAttr
.
split
(
"
/
"
);
if
(
attrs
.
length
==
0
)
{
console
.
log
(
""
)
...
...
@@ -69,16 +68,14 @@ configFunction.prototype = {
}
var
list
=
[];
for
(
var
j
=
0
;
j
<
attrs
.
length
;
j
++
)
{
if
(
projects
[
index
][
attrs
[
j
]])
{
list
.
push
(
projects
[
index
][
attrs
[
j
]].
split
(
"
"
).
join
(
"
^
"
));
}
else
{
if
(
projects
[
pName
][
attrs
[
j
]]){
list
.
push
(
projects
[
pName
][
attrs
[
j
]].
split
(
"
"
).
join
(
"
^
"
));
}
else
{
list
.
push
(
"
"
);
}
}
console
.
log
(
list
.
join
(
"
|
"
))
}
else
{
}
}
},
getProjectsAttrs
:
function
(
projects
,
attr
,
attr2
)
{
...
...
@@ -88,9 +85,9 @@ configFunction.prototype = {
}
var
list
=
[];
//attr2 专有参数,用来表示是否要取带有对外域名的服务
if
(
attr2
==
"
true
"
)
{
if
(
attr2
==
"
true
"
)
{
for
(
var
i
=
0
;
i
<
projects
.
length
;
i
++
)
{
if
(
projects
[
i
].
url
!=
""
)
{
if
(
projects
[
i
].
url
!=
""
)
{
var
li
=
[
projects
[
i
][
"
name
"
]];
for
(
var
j
=
0
;
j
<
attrs
.
length
;
j
++
)
{
li
.
push
(
projects
[
i
][
attrs
[
j
]]);
...
...
@@ -99,7 +96,7 @@ configFunction.prototype = {
list
.
push
(
li
.
join
(
"
|
"
));
}
}
}
else
{
}
else
{
for
(
var
i
=
0
;
i
<
projects
.
length
;
i
++
)
{
// if (projects[i].is_active){
var
li
=
[
projects
[
i
][
"
name
"
]];
...
...
@@ -131,26 +128,32 @@ configFunction.prototype = {
}
//tower add
module
.
exports
=
{
java
:
java_projects
,
node
:
node_projects
,
python
:
python_projects
,
ui
:
ui_projects
module
.
exports
=
{
java
:
java_projects
,
node
:
node_projects
,
python
:
python_projects
,
ui
:
ui_projects
}
var
F
=
new
configFunction
();
if
(
param
[
"
type
"
]
==
""
)
{
try
{
if
(
param
[
"
type
"
]
==
""
)
{
F
.
getProjectAttr
(
param
[
"
name
"
],
param
[
"
attr
"
]);
}
else
if
(
param
[
"
type
"
]
==
"
multi
"
)
{
}
else
if
(
param
[
"
type
"
]
==
"
multi
"
)
{
var
str
=
""
;
str
+=
F
.
getProjectsAttrs
(
java_projects
,
param
[
"
attr
"
],
param
[
"
attr2
"
]);
str
+=
"
"
+
F
.
getProjectsAttrs
(
ui_projects
,
param
[
"
attr
"
],
param
[
"
attr2
"
]);
str
+=
"
"
+
F
.
getProjectsAttrs
(
python_projects
,
param
[
"
attr
"
],
param
[
"
attr2
"
]);
str
+=
"
"
+
F
.
getProjectsAttrs
(
node_projects
,
param
[
"
attr
"
],
param
[
"
attr2
"
]);
console
.
log
(
str
)
}
else
if
(
param
[
"
type
"
]
==
"
hosts
"
)
{
}
else
if
(
param
[
"
type
"
]
==
"
hosts
"
)
{
console
.
log
(
JSON
.
stringify
(
hosts
));
}
else
{
}
else
{
F
.
getProjectsAttr
(
param
[
"
type
"
],
param
[
"
attr
"
]);
}
}
catch
(
e
)
{
console
.
log
(
e
)
}
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