Commit ff406b08 authored by 智勇's avatar 智勇
parents d51f232d 0105d1b7
...@@ -277,9 +277,9 @@ process.argv.forEach(function(val, index, array) { ...@@ -277,9 +277,9 @@ process.argv.forEach(function(val, index, array) {
function getListAttr(projects, attr) { function getListAttr(projects, attr) {
var list = []; var list = [];
for (var i = 0; i < projects.length; i++) { for (var i = 0; i < projects.length; i++) {
if (projects[i].is_active) { // if (projects[i].is_active) {
list.push(projects[i][attr]) list.push(projects[i][attr])
} // }
} }
return list.join(" "); return list.join(" ");
} }
...@@ -326,13 +326,13 @@ configFunction.prototype = { ...@@ -326,13 +326,13 @@ configFunction.prototype = {
} }
}else{ }else{
for (var i = 0; i < projects.length; i++) { for (var i = 0; i < projects.length; i++) {
if (projects[i].is_active){ // if (projects[i].is_active){
var li = [projects[i]["name"]]; var li = [projects[i]["name"]];
for (var j = 0; j < attrs.length; j++) { for (var j = 0; j < attrs.length; j++) {
li.push(projects[i][attrs[j]]); li.push(projects[i][attrs[j]]);
} }
list.push(li.join("|")); list.push(li.join("|"));
} // }
} }
} }
return list.join(" "); return list.join(" ");
......
...@@ -102,7 +102,6 @@ admin.get('/get_project_attr/:name', function (req, res) { ...@@ -102,7 +102,6 @@ admin.get('/get_project_attr/:name', function (req, res) {
// 获取所有域名 // 获取所有域名
admin.get('/get_hosts', function (req, res) { admin.get('/get_hosts', function (req, res) {
res.setHeader("Content-Type","application/json"); res.setHeader("Content-Type","application/json");
var comstr = attrComsArr.join("/");
var str = execSync(`node ./get_project_config.js -type hosts`) var str = execSync(`node ./get_project_config.js -type hosts`)
var items = String(str); var items = String(str);
res.send(items); res.send(items);
...@@ -111,20 +110,38 @@ admin.get('/get_hosts', function (req, res) { ...@@ -111,20 +110,38 @@ admin.get('/get_hosts', function (req, res) {
// 根据类型获取系统名称 // 根据类型获取系统名称
admin.get('/get_systems_by_type', function (req, res) { admin.get('/get_systems_by_type', function (req, res) {
res.setHeader("Content-Type","application/json"); res.setHeader("Content-Type","application/json");
var comstr = attrComsArr.join("/");
var ui_str = execSync(`node ./get_project_config.js -type ui -attr name`) var ui_str = execSync(`node ./get_project_config.js -type ui -attr name`)
ui_str = String(ui_str).replace(/\s/g,",").replace(/\n/g,"").slice(0, -1);; ui_str = String(ui_str)
.replace(/xyqb-ui/g,"").replace(/xjd-ui/,"xyqb-ui--xjd-ui")
.replace(/new-paycenter-ui/g,"").replace(/paycenter-ui/,"paycenter-ui--new-paycenter-ui")
.replace(/\s+/g,",").replace(/\n/g,"").slice(0, -1);
var java_str = execSync(`node ./get_project_config.js -type java -attr name`) var java_str = execSync(`node ./get_project_config.js -type java -attr name`)
var node_str = execSync(`node ./get_project_config.js -type node -attr name`) var node_str = execSync(`node ./get_project_config.js -type node -attr name`)
var python_str = execSync(`node ./get_project_config.js -type python -attr name`) var python_str = execSync(`node ./get_project_config.js -type python -attr name`)
var server_str = `${String(java_str)}${String(node_str)}${String(python_str)}` var server_str = `${String(java_str)} ${String(node_str)} ${String(python_str)}`
server_str = server_str.replace(/\s/g,",").replace(/\n/g,"").slice(0, -1);; server_str = server_str.replace(/\s+/g,",").replace(/\n/g,"").slice(0, -1);;
res.send({ res.send({
frontend:ui_str, frontend:ui_str,
backend:server_str backend:server_str
}); });
}); });
// 给jenkins使用根据类型获取系统名称
admin.get('/get_systems_by_type_for_jenkins/:_type', function (req, res) {
let str = ""
if(req.params._type === "frontend"){
var ui_str = execSync(`node ./get_project_config.js -type ui -attr name`)
str = String(ui_str)
.replace(/xyqb-ui/g,"").replace(/xjd-ui/,"xyqb-ui--xjd-ui")
.replace(/new-paycenter-ui/g,"").replace(/paycenter-ui/,"paycenter-ui--new-paycenter-ui");
}else{
var java_str = execSync(`node ./get_project_config.js -type java -attr name`)
var node_str = execSync(`node ./get_project_config.js -type node -attr name`)
var python_str = execSync(`node ./get_project_config.js -type python -attr name`)
str = `${String(java_str)} ${String(node_str)} ${String(python_str)}`
}
str = str.replace(/\n/g,"").replace(/\s+/g,"\n");
res.send(str);
});
// 增加一个新的nginx映射 // 增加一个新的nginx映射
admin.post('/add_new_proxy', function (req, res) { admin.post('/add_new_proxy', function (req, res) {
let request = req.body; let request = req.body;
......
#!/bin/bash #!/bin/bash
P_UUID=`ps -ef|grep get_project_config_server.js |grep -v 'grep'|awk '{print $2}'`
if [ -n "${P_UUID}" ];then
echo "Kill PPID=${P_UUID}"
kill -9 ${P_UUID}
sleep 2s
fi
pm2 stop project_config pm2 stop project_config
pm2 start get_project_config_server.js --node-args="--harmony" -n project_config pm2 start get_project_config_server.js --node-args="--harmony" -n project_config
......
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