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