Commit 01510169 authored by tywldx's avatar tywldx

f

parent 7802ed6d
......@@ -147,7 +147,17 @@ function getProjectConfigPromise() {
});
})
}
function getProjectConfigPromiseByDb() {
return new Promise(function (resolve, reject) {
// mongoose.model("ProConfig",new mongoose.Schema({}))
ProConfig.find({}).exec().then(res => {
// let _pros = JSON.parse(JSON.stringify(res));
resolve(res)
}).catch((err) => {
reject(err)
});
})
}
// let db_conf = db_config.db_config();
// let db_conf_keys = Object.keys(db_conf);
// 从mongo中获取DB配置
......@@ -348,6 +358,50 @@ admin.get('/get_namespace_by_type_for_jenkins/:_type', async function (req, res)
res.send(ns_array.join("\n"));
});
// 给jenkins使用获取服务groupname_projectname
admin.get('/get_groupname_by_type_for_jenkins/:_type', async function (req, res) {
let configs = await getProjectConfigPromiseByDb();
let re = {
ui:[],
java:[],
node:[],
python:[]
};
let xjdui = [["",""],["",""]],payui=[["",""],["",""]]
for(let o of configs){
if(o.project_name == "xyqb-ui"){
xjdui[0][0] = o.git_path_group
xjdui[1][0] = o.project_name
}else if(o.project_name == "paycenter-ui"){
payui[0][0] = o.git_path_group
payui[1][0] = o.project_name
}else if(o.project_name == "xjd-ui"){
xjdui[0][1] = o.git_path_group
xjdui[1][1] = o.project_name
}else if(o.project_name == "new-paycenter-ui" ){
payui[0][1] = o.git_path_group
payui[1][1] = o.project_name
}else{
if(req.params._type!="lua_ui"){
if(re[req.params._type] == undefined){
re[req.params._type] = [];
}
re[o.type].push(`${o.git_path_group}/${o.project_name}`)
}
}
}
function getLuaUiStr(item){
return `${item[0][0]}--${item[0][1]}/${item[1][0]}--${item[1][1]}`
}
let lua_ui = [],cb = "";
if(req.params._type == "lua_ui"){
lua_ui.push(getLuaUiStr(xjdui));
lua_ui.push(getLuaUiStr(payui));
cb = lua_ui.join("\n");
}else{
res.send(re[req.params._type].join("\n"));
}
});
// 增加一个新的nginx映射
admin.post('/add_new_proxy', function (req, res) {
......
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