From a8dc3ca17b5989e6ac2b47be12a27f8f5317342a Mon Sep 17 00:00:00 2001 From: philc Date: Sat, 23 Mar 2024 19:51:22 +0100 Subject: [PATCH] maj setup --- setup.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/setup.js b/setup.js index 184cdc7..bbc897a 100644 --- a/setup.js +++ b/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 = {};