1
0
forked from apxtri/apxtri

clean architecture

This commit is contained in:
philc 2024-03-20 11:24:03 +01:00
parent 56c8fd80db
commit b28df3877a
29 changed files with 31 additions and 279 deletions

View File

@ -19,8 +19,7 @@ All actors will have the same target to respect contracts and are free to leave
```plaintext ```plaintext
/town-nation/ /town-nation/
/conf/townconf.json town conf express.js /conf.json town conf express.js
/nginx/tribe_website.conf nginx conf per website
/tmp/tokens temporary files /tmp/tokens temporary files
/tribes/ tribe's space /tribes/ tribe's space
/idx/ /idx/
@ -33,6 +32,7 @@ All actors will have the same target to respect contracts and are free to leave
/routes endpoint that return {status,ref,msg,data} /routes endpoint that return {status,ref,msg,data}
apxtri.js starting point apxtri.js starting point
package.json package.json
/nginx/adminapi_adminapx.conf nginx conf per website
/schema/ list of schema for ObjectName.json title description coments are in english /schema/ list of schema for ObjectName.json title description coments are in english
/lg list of schema ObjectName_lg.json per language data (same structure than ObjectName.json but in language lg) /lg list of schema ObjectName_lg.json per language data (same structure than ObjectName.json but in language lg)
/objects/objectName/idx/ list of indexName.json /objects/objectName/idx/ list of indexName.json
@ -40,13 +40,15 @@ All actors will have the same target to respect contracts and are free to leave
/pagans Unique numeric ID shared accross all node (towns) /pagans Unique numeric ID shared accross all node (towns)
/towns Unique town name shared accross all node by domain name + IP /towns Unique town name shared accross all node by domain name + IP
/ /
/www/cdn web public access file /www/cdn/ web public access file
/share/apxtriVx.tar derniere version apxTri pour installation
/adminapx/index_lg.html administration webapp /adminapx/index_lg.html administration webapp
/website/ /website/
/tribeName/ /tribeName/
/api/routes Specific web service https://.../api/tribename/routeName/endpoint /api/routes Specific web service https://.../api/tribename/routeName/endpoint
/middlewares /middlewares
/models /models
/nginx/tribe_website.conf nginx conf per website
/schema/ /schema/
/objects/ /objects/
/www/ /www/
@ -147,7 +149,7 @@ $ sudo snap refresh core
$ sudo apt remove certbot $ sudo apt remove certbot
$ sudo snap install --classic certbot $ sudo snap install --classic certbot
$ sudo ln -s /snap/bin/certbot /usr/bin/certbot $ sudo ln -s /snap/bin/certbot /usr/bin/certbot
$ curl -L https://wall-ants.ndda.fr/cdn/setup.tar | tar -xvzf - -C ~/apxtowns/town-nation/ | cd ~/apxtowns/town-nation/tribes/adminapi/ | yarn install $ curl -L https://wall-ants.ndda.fr/cdn/apxtriv1.tar | tar -xvzf - -C ~/apxtowns/town-nation/ | cd ~/apxtowns/town-nation/tribes/adminapi/ | yarn install
$ town=townname nation=nationname dns=apxtri.ydns.io yarn startapx # for 1st install to set conf/nginx/adminapi_adminapx.conf with your parameter $ town=townname nation=nationname dns=apxtri.ydns.io yarn startapx # for 1st install to set conf/nginx/adminapi_adminapx.conf with your parameter
$ yarn restartapx # if IT IS NOT a first install $ yarn restartapx # if IT IS NOT a first install
# open a browser and type https://domain to access to your admin console # open a browser and type https://domain to access to your admin console

View File

@ -15,7 +15,7 @@ To have a quick understanding and convention before doing deeply in source code
To share configuration : To share configuration :
process.env.dirtown is folder where town folder name /townId-nationId is accessible process.env.dirtown is folder where town folder name /townId-nationId is accessible
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
app.locals.tribeids is defined later in apixtrib.js and allow express app to always have in memory a dynamic of tribeId available in req.app.locals.tribeids app.locals.tribeids is defined later in apixtrib.js and allow express app to always have in memory a dynamic of tribeId available in req.app.locals.tribeids
*/ */
/** /**
@ -54,7 +54,7 @@ argv.slice(2).forEach((arg) => {
param[kv[0]] = kv[1]; param[kv[0]] = kv[1];
} }
}); });
if (!fs.existsSync("../../../../../conf/townconf.json")) { if (!fs.existsSync("../../conf.json")) {
// This is a first install // This is a first install
const nam = path.resolve("..").split("/").slice(-1)[0].split("-"); const nam = path.resolve("..").split("/").slice(-1)[0].split("-");
const town = nam[0]; const town = nam[0];
@ -112,7 +112,7 @@ if (
} }
} }
*/ */
const conf = require(path.resolve(`../../../conf/townconf.json`)); const conf = require(path.resolve(`../../conf.json`));
let doms = conf.dns; // only dns of town during the init process let doms = conf.dns; // only dns of town during the init process
const currentmod = "apxtri"; const currentmod = "apxtri";

View File

@ -1,4 +1,4 @@
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const currentmod='checkHeaders'; const currentmod='checkHeaders';
const log = conf.api.activelog.includes(currentmod) const log = conf.api.activelog.includes(currentmod)
/** /**

View File

@ -132,7 +132,7 @@ Accessible with https://dns/api/tribename/routes
// Example of a route // Example of a route
const tribe="smatchit"; const tribe="smatchit";
const conftrib = require(`../../../itm/${tribe}.json`); const conftrib = require(`../../../itm/${tribe}.json`);
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const express = require(`../../../adminapi/apxtri/node_modules/express`); const express = require(`../../../adminapi/apxtri/node_modules/express`);
const fs = require(`../../../adminapi/apxtri/node_modules/fs-extra`); const fs = require(`../../../adminapi/apxtri/node_modules/fs-extra`);
const Nofications = require(`../../../adminapi/apxtri/models/Notifications.js`); const Nofications = require(`../../../adminapi/apxtri/models/Notifications.js`);

View File

@ -6,7 +6,7 @@ const glob = require("glob");
// const openpgp = require("/media/phil/usbfarm/apxtri/node_modules/openpgp/dist/node/openpgp.js"); // const openpgp = require("/media/phil/usbfarm/apxtri/node_modules/openpgp/dist/node/openpgp.js");
const openpgp = require("openpgp"); const openpgp = require("openpgp");
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const currentmod='isAuthenticated'; const currentmod='isAuthenticated';
const log = conf.api.activelog.includes(currentmod) const log = conf.api.activelog.includes(currentmod)
/** /**

View File

@ -4,7 +4,7 @@ const glob = require("glob");
const jwt = require("jwt-simple"); const jwt = require("jwt-simple");
const axios = require("axios"); const axios = require("axios");
const path = require("path"); const path = require("path");
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const Odmdb = require("./Odmdb.js"); const Odmdb = require("./Odmdb.js");
// lowercase 1st letter is normal // lowercase 1st letter is normal
const towns = require("./Towns.js"); const towns = require("./Towns.js");

View File

@ -6,7 +6,7 @@ const dayjs = require("dayjs");
const Checkjson = require(`./Checkjson.js`); const Checkjson = require(`./Checkjson.js`);
//const smtp = require("smtp-client"); //const smtp = require("smtp-client");
const nodemailer = require("nodemailer"); const nodemailer = require("nodemailer");
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const currentmod = "Notifications"; const currentmod = "Notifications";
const log = conf.api.activelog.includes(currentmod); const log = conf.api.activelog.includes(currentmod);
/** /**

View File

@ -3,7 +3,7 @@ const path = require("path");
const fs = require("fs-extra"); const fs = require("fs-extra");
const dayjs = require("dayjs"); const dayjs = require("dayjs");
const axios = require("axios"); const axios = require("axios");
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const Checkjson = require(`./Checkjson.js`); const Checkjson = require(`./Checkjson.js`);
const { promiseHooks } = require("v8"); const { promiseHooks } = require("v8");
const currentmod = "Odmdb"; const currentmod = "Odmdb";

View File

@ -8,7 +8,7 @@ const openpgp = require("openpgp");
const Notifications = require("./Notifications.js"); const Notifications = require("./Notifications.js");
const Odmdb = require("./Odmdb.js"); const Odmdb = require("./Odmdb.js");
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const currentmod = "Pagans"; const currentmod = "Pagans";
const log = conf.api.activelog.includes(currentmod); const log = conf.api.activelog.includes(currentmod);
/** /**
@ -128,7 +128,7 @@ Pagans.sendmailkey = (data) => {
let tplfile=`../../../${data.tribe}/template/createidentity_${data.lg}.js`; let tplfile=`../../../${data.tribe}/template/createidentity_${data.lg}.js`;
if (!fs.existsSync(tplfile)){ if (!fs.existsSync(tplfile)){
tplfile=`../../../adminapi/template/createidentity_${data.lg}.js`; tplfile=`../../adminapi/template/createidentity_${data.lg}.js`;
if (!fs.existsSync(tplfile)){ if (!fs.existsSync(tplfile)){
return { return {
status:406, status:406,

View File

@ -4,7 +4,7 @@ const glob = require("glob");
const moment = require("moment"); const moment = require("moment");
const jwt = require("jwt-simple"); const jwt = require("jwt-simple");
const UUID = require("uuid"); const UUID = require("uuid");
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const Checkjson = require(`./Checkjson.js`); const Checkjson = require(`./Checkjson.js`);
const Odmdb = require("./Odmdb.js"); const Odmdb = require("./Odmdb.js");

View File

@ -3,7 +3,7 @@ const path = require("path");
const fs = require("fs-extra"); const fs = require("fs-extra");
const dayjs = require("dayjs"); const dayjs = require("dayjs");
const axios = require("axios"); const axios = require("axios");
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const Checkjson = require(`./Checkjson.js`); const Checkjson = require(`./Checkjson.js`);
const Trackings = {} const Trackings = {}

View File

@ -10,7 +10,7 @@ const jwt = require( 'jwt-simple' );
const moment = require( 'moment' ); const moment = require( 'moment' );
const UUID = require( 'uuid' ); const UUID = require( 'uuid' );
const Pagans = require( './Pagans.js' ); const Pagans = require( './Pagans.js' );
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const Checkjson = require( `./Checkjson.js`); const Checkjson = require( `./Checkjson.js`);
/* /*
tribeid manager tribeid manager

View File

@ -3,7 +3,7 @@ const path = require("path");
const dnsSync = require("dns-sync"); const dnsSync = require("dns-sync");
const mustache = require("mustache"); const mustache = require("mustache");
const readlineSync = require("readline-sync"); const readlineSync = require("readline-sync");
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const Wwws = {}; const Wwws = {};
/*Wwws.apxtriinstall = (paramconf) => { /*Wwws.apxtriinstall = (paramconf) => {

View File

@ -3,7 +3,7 @@ Unit testing
*/ */
const assert = require("assert"); const assert = require("assert");
const Checkjson = require("../Checkjson.js"); const Checkjson = require("../Checkjson.js");
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const ut = { name: "Checkjson" }; const ut = { name: "Checkjson" };

View File

@ -6,7 +6,7 @@ const fs = require("fs-extra");
const path = require("path"); const path = require("path");
const Odmdb = require("../Odmdb.js"); const Odmdb = require("../Odmdb.js");
const { generemdp } = require("../toolsbox.js"); const { generemdp } = require("../toolsbox.js");
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const ut = { name: "Odmdb" }; const ut = { name: "Odmdb" };
/* /*
@ -26,7 +26,7 @@ ut.crud = (objectPathname, itm, profils) => {
const testvar={alias:"tutu", passphrase:"",privatekey:"", publickey:""} const testvar={alias:"tutu", passphrase:"",privatekey:"", publickey:""}
const testitms=[ const testitms=[
{objectPathname:`../../../../adminapi/opjects/pagans`, {objectPathname:`../../../adminapi/opjects/pagans`,
itm:{alias:'toutou', publickey:}} itm:{alias:'toutou', publickey:}}
] ]

View File

@ -15,12 +15,14 @@
"restartapx": "pm2 restart apxtri.js --log-date-format 'DD-MM HH:mm:ss.SSS'", "restartapx": "pm2 restart apxtri.js --log-date-format 'DD-MM HH:mm:ss.SSS'",
"dev": "NODE_MODE=dev node apxtri.js", "dev": "NODE_MODE=dev node apxtri.js",
"unittest": "node unittest.js", "unittest": "node unittest.js",
"tar2prod": "rm ../objects/wwws/cdn/share/apxtriV* && tar -czf ../objects/wwws/cdn/share/apxtriV$version.tar --exclude='node_modules' --exclude='.git' ../../adminapi/apxtri ../../adminapi/schema ../../adminapi/objects ../../adminapi/template ../../itm/adminapi.json",
"apidoc": "apidoc -c ../../../conf/apidoc/apidoc_$tribe.json -o ../../$tribe/objects/wwws/cdn/apidoc/", "apidoc": "apidoc -c ../../../conf/apidoc/apidoc_$tribe.json -o ../../$tribe/objects/wwws/cdn/apidoc/",
"publishtestwall": "scp -r /media/phil/usbfarm/apxtowns/dev-ants/tribes/$space phil@wall-ants://home/phil/apxtowns/testwall-ants/tribes/$space/..", "publishtestwall": "scp -r /media/phil/usbfarm/apxtowns/dev-ants/tribes/$space phil@wall-ants://home/phil/apxtowns/testwall-ants/tribes/$space/..",
"publishwall": "scp -r /media/phil/usbfarm/apxtowns/dev-ants/tribes/$space phil@wall-ants://home/phil/apxtowns/wall-ants/tribes/$space/..", "publishwall": "scp -r /media/phil/usbfarm/apxtowns/dev-ants/tribes/$space phil@wall-ants://home/phil/apxtowns/wall-ants/tribes/$space/..",
"publishhouse": "scp -r /media/phil/usbfarm/apxtowns/dev-ants/tribes/$space phil@house-ants://home/phil/apxtowns/house-ants/tribes/$space/.." "publishhouse": "scp -r /media/phil/usbfarm/apxtowns/dev-ants/tribes/$space phil@house-ants://home/phil/apxtowns/house-ants/tribes/$space/.."
}, },
"commentscript": "cf wiki apxtri doc for details: yarn startpm2 -n teswallants, yarn pm2 stop testwallants, yarn pm2 delete testwallants, yarn pm2 logs --lines 200 testwall, yarn pm2 monit -n testwallants, yarn pm2 save tribe=tribeid yarn apidoc to build apidoc // space=adminapi/www/cdn/apidoc yarn publishtestwall ", "commentscript": "cf wiki apxtri doc for details: yarn startpm2 -n teswallants, yarn pm2 stop testwallants, yarn pm2 delete testwallants, yarn pm2 logs --lines 200 testwall, yarn pm2 monit -n testwallants, yarn pm2 save tribe=tribeid yarn apidoc to build apidoc // space=adminapi/www/cdn/apidoc yarn publishtestwall ",
"commentinstallprod":"A lancer en yarn 'version=1 yarn run tar2prod' pour generer un tar d'installation disponible en ligne sur towndns/cdn/share/apxtriV.tar pour install voir le readme qui run in apxtowns mkdir newtown && tar -xf appv1.tar -C newtown",
"maintainers": [ "maintainers": [
{ {
"name": "Philippe Colzy", "name": "Philippe Colzy",

View File

@ -1,6 +1,6 @@
const express = require( 'express' ); const express = require( 'express' );
const fs=require('fs-extra'); const fs=require('fs-extra');
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
// Classes // Classes
const Nations = require( '../models/Nations.js' ); const Nations = require( '../models/Nations.js' );

View File

@ -2,7 +2,7 @@ const express = require("express");
const glob = require("glob"); const glob = require("glob");
const fs = require("fs-extra"); const fs = require("fs-extra");
const path = require("path"); const path = require("path");
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const Odmdb = require("../models/Odmdb.js"); const Odmdb = require("../models/Odmdb.js");
// Middlewares // Middlewares
const checkHeaders = require("../middlewares/checkHeaders.js"); const checkHeaders = require("../middlewares/checkHeaders.js");

View File

@ -9,7 +9,7 @@ const Odmdb = require("../models/Odmdb.js");
const checkHeaders = require("../middlewares/checkHeaders.js"); const checkHeaders = require("../middlewares/checkHeaders.js");
const isAuthenticated = require("../middlewares/isAuthenticated.js"); const isAuthenticated = require("../middlewares/isAuthenticated.js");
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const currentmod = "pagans"; const currentmod = "pagans";
const log = conf.api.activelog.includes(currentmod); const log = conf.api.activelog.includes(currentmod);

View File

@ -2,7 +2,7 @@ const express = require("express");
const glob = require("glob"); const glob = require("glob");
const fs = require("fs-extra"); const fs = require("fs-extra");
const path = require("path"); const path = require("path");
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
const Odmdb = require("../models/Odmdb.js"); const Odmdb = require("../models/Odmdb.js");
// Middlewares // Middlewares
const checkHeaders = require("../middlewares/checkHeaders"); const checkHeaders = require("../middlewares/checkHeaders");

View File

@ -2,7 +2,7 @@ const express = require( 'express' );
const fs = require( 'fs-extra' ); const fs = require( 'fs-extra' );
const path = require( 'path' ); const path = require( 'path' );
const glob = require('glob'); const glob = require('glob');
const conf = require(`../../../../conf/townconf.json`); const conf = require(`../../../conf.json`);
// Classes // Classes
const Tribes = require( '../models/Tribes.js' ); const Tribes = require( '../models/Tribes.js' );

Binary file not shown.

View File

@ -1,34 +0,0 @@
{ "chaintonation":false,
"dns": ["devfarm-ants"],
"towns": [
{ "townId": "wall", "nationId": "ants", "dns": "wall-ants.ndda.fr" }
],
"api": {
"port": 3020,
"languages": ["en", "fr"],
"exposedHeaders": ["xdays", "xhash", "xalias", "xlang", "xtribe", "xapp","xuuid"],
"nationObjects": [
"schema",
"blocks",
"nations",
"towns",
"tribes",
"pagans"
],
"unittesting": ["middlewares", "models", "routes", "nationchains"],
"appset": { "trust proxy": true },
"bodyparse": {
"urlencoded": {
"limit": "50mb",
"extended": true
},
"json": { "limit": "500mb" }
}
},
"nginx": {
"restart": "sudo systemctl restart nginx",
"worker_connections": 1024,
"include": ["/etc/nginx/conf.d/*.conf"],
"pageindex": "index_en.html"
}
}

View File

@ -1 +0,0 @@
{"nationId":"ants","townId":"devfarm","dns":"devfarm-ants","comment":"Auto generate setup from apxtri after node apxtri nationId:value townId:value dns:domaine_to_access","mayorId":"philc"}

View File

@ -1,42 +0,0 @@
user {{{sudoerUser}}};
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
#include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections {{nginx.worker_connections}};
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$time_iso8601###$status###$request';
log_format tracker escape=json
'{"time":"$time_iso8601","alias":"$arg_alias","uuid":"$arg_uuid",'
'"lg":"$arg_lg","consentcookie":"$arg_consentcookie","version":"$arg_version",'
'"srckey":"$arg_srckey","request_filename":"$request_filename",'
'"remoteaddr":"$remote_addr","httpxforwardedfor":"$http_x_forwarded_for",'
'"httpreferer":"$http_referer","httpuseragent":"$http_user_agent","request":"$request"}';
log_format mainold '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 4 32k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/x-font-ttf application/javascript font/eot font/opentype image/svg+xml image/x-icon text/plain;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /home/{{sudoerUser}}/apxtowns/{{townId}}-{{nationId}}/conf/nginx/*.conf;
}

View File

@ -1,81 +0,0 @@
server {
server_name {{#dns}} {{.}} {{/dns}};
access_log {{foldertowns}}/{{townId}}-{{nationId}}/tribes/log/nginx/{{tribeId}}_{{website}}.access.log main;
set $trackme 0;
if ( $uri ~ ^/trk/ ){
set $trackme 1;
}
access_log {{foldertowns}}/{{townId}}-{{nationId}}/tribes/log/nginx/{{tribeId}}_{{website}}.trk.log tracker if=$trackme ;
location ~* /trk/ {
if ( $uri ~ ^/trk/redirect ){
return 301 $arg_url;
}
rewrite ^/trk/(.*)$ /$1;
}
location /Checkjson.js {
alias {{foldertowns}}/{{townId}}-{{nationId}}/apxtri/models/Checkjson.js;
}
location ~* /nationchains/(blocks|pagans|towns|nations)/ {
# Warning: never add tribes for keeping it private
root {{foldertowns}}/{{townId}}-{{nationId}}/nationchains/;
}
location ~* /nationchains/models/ {
rewrite /nationchains/models/(.*$) /$1 break;
root {{foldertowns}}/{{townId}}-{{nationId}}/apxtri/models/lg/;
}
location ~* /nationchains/schema/ {
#outside of nationchains for git purpose
rewrite /nationchains/schema/(.*$) /$1 break;
root {{{foldertowns}}/{{townId}}-{{nationId}}/tribes/adminapi/schema/;
}
location ~* /{{tribeId}}/schema/{
rewrite /{{tribeId}}/schema/(.*$) /$1 break;
root {{foldertowns}}/{{townId}}-{{nationId}}/tribes/{{tribeId}}/schema/;
}
location ~* /{{tribeId}}/models/{
rewrite /{{tribeId}}/models/(.*$) /$1 break;
root {{foldertowns}}/{{townId}}-{{nationId}}/tribes/{{tribeId}}/api/models/lg/;
}
location /cdn/ {
expires 1y;
add_header Cache-Control "public";
rewrite /cdn/(.*$) /$1 break;
root {{foldertowns}}/{{townId}}-{{nationId}}/tribes/{{tribeId}}/www//cdn/;
}
location /api/ {
rewrite /api/(.*$) /$1 break;
proxy_pass http://localhost:{{{api.port}}};
proxy_redirect off;
include proxy_params;
}
location /apxwebapp/ {
rewrite /apxwebapp/(.*$) /$1 break;
root {{foldertowns}}/apxwebapp/;
index index.html index_en.html;
}
#to add htpasswd install apache2-utils => sudo htpasswd -c dirtown/tribes/tribeId/.htpasswd loginname passwd see man for
option
location / {
{{#private}}
auth_basic "Mot de passe {{privatelogin}}";
auth_basic_user_file {{{foldertowns}}/{{townId}}-{{nationId}}/tribes/{{tribeId}}/.htpasswd;
{{/private}}
root {{foldertowns}}/{{townId}}-{{nationId}}/tribes/{{tribeId}}/www/{{{website}}};
index index.html {{{pageindex}}};
}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/nginx/html;
}
}

View File

@ -1,11 +0,0 @@
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffers 32 4k;
proxy_set_header X-NginX-Proxy true;

View File

@ -1,55 +0,0 @@
{ "chaintonation":false,
"foldertowns":"xx/apxtowns",
"nationId": "xx",
"townId": "xx",
"sudoerUser": "xx",
"dns": ["xx"],
"towns": [
{ "townId": "wall", "nationId": "ants", "dns": "wall-ants.ndda.fr" }
],
"api": {
"port": 3020,
"languages": ["en", "fr"],
"exposedHeaders": [
"xdays",
"xhash",
"xalias",
"xlang",
"xtribe",
"xapp",
"xuuid"
],
"nationObjects": [
"schema",
"blocks",
"nations",
"towns",
"tribes",
"pagans"
],
"unittesting": ["middlewares", "models", "routes", "nationchains"],
"appset": { "trust proxy": true },
"bodyparse": {
"urlencoded": { "limit": "50mb", "extended": true },
"json": { "limit": "500mb" }
}
},
"nginx": {
"restart": "sudo systemctl restart nginx",
"worker_connections": 1024
},
"emailcontact":"wall-ants@ndda.fr",
"smtp": {
"host": "in-v3.mailjet.com",
"port": "587",
"auth": {
"user": "??",
"password": "??"
}
},
"sms": {
"url": "https://api.mailjet.com/v4/sms-send",
"Token": "",
"From": ""
}
}

View File

@ -1,28 +0,0 @@
const fs = require("fs-extra");
const dayjs = require("dayjs");
const conf = require(`../../../../conf/townconf.json`);
const l = {};
l.context="";
l.og = (...infos) => {
// in apxtowns/towns/conf/townconf.json .api.activelog a list of context to log
// usage:
// const l=require('./tools/log.js');
// l.context="apxtri"; // name of model route to find it easily
// then l.og(str1,str2,array1,objet,...)
//console.log(infos)
if (conf.api.activelog.includes(l.context)) {
console.log(l.context,'-', ...infos);
}
//console.assert(conf.api.activelog.includes(l.context),infos)
};
l.ogprod = (tribe,info) => {
const logf = `../../tribes/${tribe}/logs/apxtri/apxtri_${tribe}.log`;
const msg = `${days.js().toISOString()}###${l.context}###${tribe}###${info}`;
fs.appendFileSync(logf, msg);
console.log(msg)
};
module.exports = l;