diff --git a/README.md b/README.md index 6bef7df..da54560 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,7 @@ All actors will have the same target to respect contracts and are free to leave ```plaintext /town-nation/ - /conf/townconf.json town conf express.js - /nginx/tribe_website.conf nginx conf per website + /conf.json town conf express.js /tmp/tokens temporary files /tribes/ tribe's space /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} apxtri.js starting point package.json + /nginx/adminapi_adminapx.conf nginx conf per website /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) /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) /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 /website/ /tribeName/ /api/routes Specific web service https://.../api/tribename/routeName/endpoint /middlewares /models + /nginx/tribe_website.conf nginx conf per website /schema/ /objects/ /www/ @@ -147,7 +149,7 @@ $ sudo snap refresh core $ sudo apt remove certbot $ sudo snap install --classic 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 $ yarn restartapx # if IT IS NOT a first install # open a browser and type https://domain to access to your admin console diff --git a/apxtri.js b/apxtri.js index 9ce1380..aa3d4b8 100755 --- a/apxtri.js +++ b/apxtri.js @@ -15,7 +15,7 @@ To have a quick understanding and convention before doing deeply in source code To share configuration : 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 */ /** @@ -54,7 +54,7 @@ argv.slice(2).forEach((arg) => { param[kv[0]] = kv[1]; } }); -if (!fs.existsSync("../../../../../conf/townconf.json")) { +if (!fs.existsSync("../../conf.json")) { // This is a first install const nam = path.resolve("..").split("/").slice(-1)[0].split("-"); 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 const currentmod = "apxtri"; diff --git a/middlewares/checkHeaders.js b/middlewares/checkHeaders.js index 619540c..cf17f12 100755 --- a/middlewares/checkHeaders.js +++ b/middlewares/checkHeaders.js @@ -1,4 +1,4 @@ -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); const currentmod='checkHeaders'; const log = conf.api.activelog.includes(currentmod) /** diff --git a/middlewares/header.md b/middlewares/header.md index 6cb3cb8..2d00cd8 100644 --- a/middlewares/header.md +++ b/middlewares/header.md @@ -132,7 +132,7 @@ Accessible with https://dns/api/tribename/routes // Example of a route const tribe="smatchit"; 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 fs = require(`../../../adminapi/apxtri/node_modules/fs-extra`); const Nofications = require(`../../../adminapi/apxtri/models/Notifications.js`); diff --git a/middlewares/isAuthenticated.js b/middlewares/isAuthenticated.js index b570b21..64b92be 100755 --- a/middlewares/isAuthenticated.js +++ b/middlewares/isAuthenticated.js @@ -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("openpgp"); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); const currentmod='isAuthenticated'; const log = conf.api.activelog.includes(currentmod) /** diff --git a/models/Nations.js b/models/Nations.js index 498baa4..cb05f91 100755 --- a/models/Nations.js +++ b/models/Nations.js @@ -4,7 +4,7 @@ const glob = require("glob"); const jwt = require("jwt-simple"); const axios = require("axios"); const path = require("path"); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); const Odmdb = require("./Odmdb.js"); // lowercase 1st letter is normal const towns = require("./Towns.js"); diff --git a/models/Notifications.js b/models/Notifications.js index 4b680c5..57cd58a 100644 --- a/models/Notifications.js +++ b/models/Notifications.js @@ -6,7 +6,7 @@ const dayjs = require("dayjs"); const Checkjson = require(`./Checkjson.js`); //const smtp = require("smtp-client"); const nodemailer = require("nodemailer"); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); const currentmod = "Notifications"; const log = conf.api.activelog.includes(currentmod); /** diff --git a/models/Odmdb.js b/models/Odmdb.js index 6598408..3e1ad8f 100644 --- a/models/Odmdb.js +++ b/models/Odmdb.js @@ -3,7 +3,7 @@ const path = require("path"); const fs = require("fs-extra"); const dayjs = require("dayjs"); const axios = require("axios"); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); const Checkjson = require(`./Checkjson.js`); const { promiseHooks } = require("v8"); const currentmod = "Odmdb"; diff --git a/models/Pagans.js b/models/Pagans.js index df616c7..68bfd95 100644 --- a/models/Pagans.js +++ b/models/Pagans.js @@ -8,7 +8,7 @@ const openpgp = require("openpgp"); const Notifications = require("./Notifications.js"); const Odmdb = require("./Odmdb.js"); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); const currentmod = "Pagans"; const log = conf.api.activelog.includes(currentmod); /** @@ -128,7 +128,7 @@ Pagans.sendmailkey = (data) => { let tplfile=`../../../${data.tribe}/template/createidentity_${data.lg}.js`; if (!fs.existsSync(tplfile)){ - tplfile=`../../../adminapi/template/createidentity_${data.lg}.js`; + tplfile=`../../adminapi/template/createidentity_${data.lg}.js`; if (!fs.existsSync(tplfile)){ return { status:406, diff --git a/models/Towns.js b/models/Towns.js index b5308f9..d396779 100644 --- a/models/Towns.js +++ b/models/Towns.js @@ -4,7 +4,7 @@ const glob = require("glob"); const moment = require("moment"); const jwt = require("jwt-simple"); const UUID = require("uuid"); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); const Checkjson = require(`./Checkjson.js`); const Odmdb = require("./Odmdb.js"); diff --git a/models/Trackings.js b/models/Trackings.js index cd708a3..7e49f37 100644 --- a/models/Trackings.js +++ b/models/Trackings.js @@ -3,7 +3,7 @@ const path = require("path"); const fs = require("fs-extra"); const dayjs = require("dayjs"); const axios = require("axios"); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); const Checkjson = require(`./Checkjson.js`); const Trackings = {} diff --git a/models/Tribes.js b/models/Tribes.js index 71ed589..ac8e0db 100755 --- a/models/Tribes.js +++ b/models/Tribes.js @@ -10,7 +10,7 @@ const jwt = require( 'jwt-simple' ); const moment = require( 'moment' ); const UUID = require( 'uuid' ); const Pagans = require( './Pagans.js' ); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); const Checkjson = require( `./Checkjson.js`); /* tribeid manager diff --git a/models/Wwws.js b/models/Wwws.js index 213a3e5..9b5ebff 100644 --- a/models/Wwws.js +++ b/models/Wwws.js @@ -3,7 +3,7 @@ const path = require("path"); const dnsSync = require("dns-sync"); const mustache = require("mustache"); const readlineSync = require("readline-sync"); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); const Wwws = {}; /*Wwws.apxtriinstall = (paramconf) => { diff --git a/models/unittest/Checkjson.js b/models/unittest/Checkjson.js index a464a16..fb38b8a 100644 --- a/models/unittest/Checkjson.js +++ b/models/unittest/Checkjson.js @@ -3,7 +3,7 @@ Unit testing */ const assert = require("assert"); const Checkjson = require("../Checkjson.js"); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); const ut = { name: "Checkjson" }; diff --git a/models/unittest/Odmdb.js b/models/unittest/Odmdb.js index 67cdc06..9baa752 100644 --- a/models/unittest/Odmdb.js +++ b/models/unittest/Odmdb.js @@ -6,7 +6,7 @@ const fs = require("fs-extra"); const path = require("path"); const Odmdb = require("../Odmdb.js"); const { generemdp } = require("../toolsbox.js"); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); const ut = { name: "Odmdb" }; /* @@ -26,7 +26,7 @@ ut.crud = (objectPathname, itm, profils) => { const testvar={alias:"tutu", passphrase:"",privatekey:"", publickey:""} const testitms=[ - {objectPathname:`../../../../adminapi/opjects/pagans`, + {objectPathname:`../../../adminapi/opjects/pagans`, itm:{alias:'toutou', publickey:}} ] diff --git a/package.json b/package.json index 8864c8a..15b5723 100755 --- a/package.json +++ b/package.json @@ -15,12 +15,14 @@ "restartapx": "pm2 restart apxtri.js --log-date-format 'DD-MM HH:mm:ss.SSS'", "dev": "NODE_MODE=dev node apxtri.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/", "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/..", "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 ", + "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": [ { "name": "Philippe Colzy", diff --git a/routes/nations.js b/routes/nations.js index 7212b60..9fa40d2 100755 --- a/routes/nations.js +++ b/routes/nations.js @@ -1,6 +1,6 @@ const express = require( 'express' ); const fs=require('fs-extra'); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); // Classes const Nations = require( '../models/Nations.js' ); diff --git a/routes/odmdb.js b/routes/odmdb.js index a861028..0ec9225 100644 --- a/routes/odmdb.js +++ b/routes/odmdb.js @@ -2,7 +2,7 @@ const express = require("express"); const glob = require("glob"); const fs = require("fs-extra"); const path = require("path"); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); const Odmdb = require("../models/Odmdb.js"); // Middlewares const checkHeaders = require("../middlewares/checkHeaders.js"); diff --git a/routes/pagans.js b/routes/pagans.js index 5cbf5a1..4104d9b 100755 --- a/routes/pagans.js +++ b/routes/pagans.js @@ -9,7 +9,7 @@ const Odmdb = require("../models/Odmdb.js"); const checkHeaders = require("../middlewares/checkHeaders.js"); const isAuthenticated = require("../middlewares/isAuthenticated.js"); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); const currentmod = "pagans"; const log = conf.api.activelog.includes(currentmod); diff --git a/routes/trackings.js b/routes/trackings.js index c57e3b8..7144fb4 100644 --- a/routes/trackings.js +++ b/routes/trackings.js @@ -2,7 +2,7 @@ const express = require("express"); const glob = require("glob"); const fs = require("fs-extra"); const path = require("path"); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); const Odmdb = require("../models/Odmdb.js"); // Middlewares const checkHeaders = require("../middlewares/checkHeaders"); diff --git a/routes/tribes.js b/routes/tribes.js index 7bcadc7..4c6b343 100755 --- a/routes/tribes.js +++ b/routes/tribes.js @@ -2,7 +2,7 @@ const express = require( 'express' ); const fs = require( 'fs-extra' ); const path = require( 'path' ); const glob = require('glob'); -const conf = require(`../../../../conf/townconf.json`); +const conf = require(`../../../conf.json`); // Classes const Tribes = require( '../models/Tribes.js' ); diff --git a/setup/adminapx_1.zip b/setup/adminapx_1.zip deleted file mode 100644 index 7fc1e86..0000000 Binary files a/setup/adminapx_1.zip and /dev/null differ diff --git a/setup/conf/ASUPinitconf.json b/setup/conf/ASUPinitconf.json deleted file mode 100644 index b3c2501..0000000 --- a/setup/conf/ASUPinitconf.json +++ /dev/null @@ -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" - } -} diff --git a/setup/conf/ASUPsetup_xx.json b/setup/conf/ASUPsetup_xx.json deleted file mode 100644 index 6c31518..0000000 --- a/setup/conf/ASUPsetup_xx.json +++ /dev/null @@ -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"} diff --git a/setup/conf/nginx/nginx.conf.mustache b/setup/conf/nginx/nginx.conf.mustache deleted file mode 100755 index 5bdf9e8..0000000 --- a/setup/conf/nginx/nginx.conf.mustache +++ /dev/null @@ -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; -} diff --git a/setup/conf/nginx/nginxmodelwebsite.conf.mustache b/setup/conf/nginx/nginxmodelwebsite.conf.mustache deleted file mode 100755 index df4c680..0000000 --- a/setup/conf/nginx/nginxmodelwebsite.conf.mustache +++ /dev/null @@ -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; -} -} \ No newline at end of file diff --git a/setup/conf/nginx/nginxproxyparams.mustache b/setup/conf/nginx/nginxproxyparams.mustache deleted file mode 100644 index 1b73dde..0000000 --- a/setup/conf/nginx/nginxproxyparams.mustache +++ /dev/null @@ -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; \ No newline at end of file diff --git a/setup/conf/townconf.json b/setup/conf/townconf.json deleted file mode 100644 index 2adc5cf..0000000 --- a/setup/conf/townconf.json +++ /dev/null @@ -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": "" - } - } \ No newline at end of file diff --git a/tools/log.js b/tools/log.js deleted file mode 100644 index ada94c7..0000000 --- a/tools/log.js +++ /dev/null @@ -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;