fix bug
This commit is contained in:
parent
da24db5510
commit
4085bb26d7
@ -102,7 +102,7 @@ apxtri.setuptribe = async (tribe, conf) => {
|
|||||||
try {
|
try {
|
||||||
inittribe = conf;
|
inittribe = conf;
|
||||||
inittribe.townpath = __dirname.replace("/adminapi/apxtri", "");
|
inittribe.townpath = __dirname.replace("/adminapi/apxtri", "");
|
||||||
const townnation = inittribe.townpath.split("/").slice(-1)[0].split("-")
|
const townnation = inittribe.townpath.split("/").slice(-1)[0].split("-");
|
||||||
inittribe.townId = townnation[0];
|
inittribe.townId = townnation[0];
|
||||||
inittribe.nationId = townnation[1];
|
inittribe.nationId = townnation[1];
|
||||||
inittribe.dns.push(`adminapi.${inittribe.townId}.${inittribe.nationId}`);
|
inittribe.dns.push(`adminapi.${inittribe.townId}.${inittribe.nationId}`);
|
||||||
@ -114,7 +114,7 @@ apxtri.setuptribe = async (tribe, conf) => {
|
|||||||
console.log(`a new tribe called ${tribe} was detected`);
|
console.log(`a new tribe called ${tribe} was detected`);
|
||||||
inittribe = {
|
inittribe = {
|
||||||
tribeId: tribe,
|
tribeId: tribe,
|
||||||
townpath : __dirname.replace("/adminapi/apxtri", ""),
|
townpath: __dirname.replace("/adminapi/apxtri", ""),
|
||||||
dns: [`admin.${tribe}.${conf.townId}.${conf.nationId}`],
|
dns: [`admin.${tribe}.${conf.townId}.${conf.nationId}`],
|
||||||
status: "unchain",
|
status: "unchain",
|
||||||
nationId: conf.nationId,
|
nationId: conf.nationId,
|
||||||
@ -196,14 +196,18 @@ apxtri.setuptribe = async (tribe, conf) => {
|
|||||||
// this command is ran by the setup.sh
|
// this command is ran by the setup.sh
|
||||||
// grep -q '^127.0.0.1 adminapx.adminapi' /etc/hosts || echo '127.0.0.1 adminapx.adminapi' | sudo tee -a /etc/hosts > /dev/null
|
// grep -q '^127.0.0.1 adminapx.adminapi' /etc/hosts || echo '127.0.0.1 adminapx.adminapi' | sudo tee -a /etc/hosts > /dev/null
|
||||||
const ips = await getip();
|
const ips = await getip();
|
||||||
|
const nginrestart = initadminapi.nginx.restart
|
||||||
|
? initadminapi.nginx.restart
|
||||||
|
: fs.readJSONSync("../adminapi/apxtri/setup/initadminapi.json").nginx
|
||||||
|
.restart;
|
||||||
const { exec } = require("child_process");
|
const { exec } = require("child_process");
|
||||||
exec(initadminapi.nginx.restart, (error, stdout, stderr) => {
|
exec(nginxrestart, (error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log("\x1b[42m", error, stdout, stderr, "x1b[0m");
|
console.log("\x1b[42m", error, stdout, stderr, "x1b[0m");
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
} else {
|
} else {
|
||||||
const etchosts = Object.values(ips)
|
const etchosts = Object.values(ips)
|
||||||
.map((ip) => `${ip} ${initadminapi.website}`)
|
.map((ip) => `${ip} ${inittribe.website}`)
|
||||||
.join("\n ");
|
.join("\n ");
|
||||||
console.log(
|
console.log(
|
||||||
`\x1b[42m###############################################################################################################\x1b[0m\n\x1b[42mWellcome into this fresh apxtri install, currently running as "$ yarn dev".\n To access and set up a public domain name, add lines in file /etc/hosts into the machine you want to use to access:\n ${etchosts} \n Then open in your local browser \x1b[0m\x1b[32m http://${initadminapi.website} \x1b[0m \x1b[42m \nFor local dev continue with 'yarn dev'\nTo run as a production run 'yarn startapx' or 'yarn restartapx' then pm2 monitor your production process.\n\x1b[0m\n\x1b[42m###############################################################################################################\x1b[0m`
|
`\x1b[42m###############################################################################################################\x1b[0m\n\x1b[42mWellcome into this fresh apxtri install, currently running as "$ yarn dev".\n To access and set up a public domain name, add lines in file /etc/hosts into the machine you want to use to access:\n ${etchosts} \n Then open in your local browser \x1b[0m\x1b[32m http://${initadminapi.website} \x1b[0m \x1b[42m \nFor local dev continue with 'yarn dev'\nTo run as a production run 'yarn startapx' or 'yarn restartapx' then pm2 monitor your production process.\n\x1b[0m\n\x1b[42m###############################################################################################################\x1b[0m`
|
||||||
|
Loading…
Reference in New Issue
Block a user