forked from apxtri/apxtri
maj setup
This commit is contained in:
parent
9549e973a2
commit
a8dc3ca17b
16
setup.js
16
setup.js
@ -123,7 +123,7 @@ server {
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Setup.addtribe = (tribeId) => {
|
Setup.addtribe = (tribeId, town, nation) => {
|
||||||
const idxtribf = `../../idx/tribeId_all.json`;
|
const idxtribf = `../../idx/tribeId_all.json`;
|
||||||
const idxtrib = fs.existsSync(idxtribf) ? fs.readJSONSync(idxtribf) : {};
|
const idxtrib = fs.existsSync(idxtribf) ? fs.readJSONSync(idxtribf) : {};
|
||||||
if (idxtrib[tribeId]) {
|
if (idxtrib[tribeId]) {
|
||||||
@ -135,9 +135,9 @@ Setup.addtribe = (tribeId) => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
const tribdata = {
|
const tribdata = {
|
||||||
nationId: nationId,
|
nationId: nation,
|
||||||
townId: townId,
|
townId: town,
|
||||||
tribeId: tribeId,
|
tribeId: tribe
|
||||||
};
|
};
|
||||||
idxtrib[tribeId] = tribdata;
|
idxtrib[tribeId] = tribdata;
|
||||||
fs.outputJSON(idxtribf, idxtrib, { spaces: 2 });
|
fs.outputJSON(idxtribf, idxtrib, { spaces: 2 });
|
||||||
@ -162,8 +162,8 @@ Setup.addwww = (tribeId,webspace,confdata) => {
|
|||||||
"utf-8"
|
"utf-8"
|
||||||
);
|
);
|
||||||
fs.outputFile(
|
fs.outputFile(
|
||||||
`${confdata.apxtowns}/{{tribe}}/nginx/{{tribe}}_{{webspace}}.conf`,
|
`${confdata.apxtowns}/${tribeId}/nginx/${tribeId}_${webspace}.conf`,
|
||||||
mustache.render(Setup.{{tribe}}nginxconf, confdata),
|
mustache.render(Setup.adminapinginxconf, confdata),
|
||||||
"utf-8"
|
"utf-8"
|
||||||
);
|
);
|
||||||
const res={status:200,ref:"setup",msg:"wwwssuccess",data:confdata}
|
const res={status:200,ref:"setup",msg:"wwwssuccess",data:confdata}
|
||||||
@ -208,13 +208,13 @@ Setup.init = (param) => {
|
|||||||
if (!setupdone) return false;
|
if (!setupdone) return false;
|
||||||
confdata.dns = [param.dns];
|
confdata.dns = [param.dns];
|
||||||
confdata.user = param.user;
|
confdata.user = param.user;
|
||||||
const addtribe = Setup.addtribe("{{tribe}}", confdata.town, confdata.nation);
|
const addtribe = Setup.addtribe("adminapi", confdata.town, confdata.nation);
|
||||||
if (addtribe.status != 200) {
|
if (addtribe.status != 200) {
|
||||||
console.log("erreur de creation");
|
console.log("erreur de creation");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// set nginx
|
// set nginx
|
||||||
const addwww = Setup.addwww("{{tribe}}","admibnapx",confdata);
|
const addwww = Setup.addwww("adminapi","admibnapx",confdata);
|
||||||
};
|
};
|
||||||
|
|
||||||
const param = {};
|
const param = {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user