Skip to content

Commit

Permalink
Fix db not triggered subdomain
Browse files Browse the repository at this point in the history
  • Loading branch information
willnode committed Jun 12, 2024
1 parent 05072d8 commit 1bc238d
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions src/executor/runnersub.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec,
}
if (value === "off") {
await writeLog("$> Disabling MySQL");
if (enabled) {
if (subenabled) {
await virtExec("disable-feature", value, {
subdomain,
mysql: true,
Expand All @@ -66,7 +66,7 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec,
}
break;
}
if (!enabled) {
if (!subenabled) {
await writeLog("$> Enabling MySQL");
await virtExec("enable-feature", value, {
subdomain,
Expand All @@ -79,15 +79,14 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec,
dbname = getDbName(domaindata['Username'], domainprefix == "db" ? newdb : domainprefix + '_' + newdb);
dbneedcreate = true;
}
if (!dbneedcreate) {
break;
if (dbneedcreate) {
await writeLog(`$> Creating db instance ${dbname} on MySQL`);
await virtExec("create-database", {
subdomain,
name: dbname,
type: 'mysql',
});
}
await writeLog(`$> Creating db instance ${dbname} on MySQL`);
await virtExec("create-database", {
subdomain,
name: dbname,
type: 'mysql',
});
break;
case 'postgres':
if (!stillroot && !enabled) {
Expand All @@ -96,7 +95,7 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec,
}
if (value === "off") {
await writeLog("$> Disabling PostgreSQL");
if (enabled) {
if (subenabled) {
await virtExec("disable-feature", value, {
subdomain,
postgres: true,
Expand All @@ -106,7 +105,7 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec,
}
break;
}
if (!enabled) {
if (!subenabled) {
await writeLog("$> Enabling PostgreSQL");
await virtExec("enable-feature", value, {
subdomain,
Expand All @@ -119,15 +118,15 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec,
dbname = getDbName(domaindata['Username'], domainprefix == "db" ? newdb : domainprefix + '_' + newdb);
dbneedcreate = true;
}
if (!dbneedcreate) {
break;
if (dbneedcreate) {
await writeLog(`$> Creating db instance ${dbname} on PostgreSQL`);
await virtExec("create-database", {
subdomain,
name: dbname,
type: 'postgres',
}
);
}
await writeLog(`$> Creating db instance ${dbname} on PostgreSQL`);
await virtExec("create-database", {
subdomain,
name: dbname,
type: 'postgres',
});
break;
case 'dns':
if (!stillroot && !enabled) {
Expand Down

0 comments on commit 1bc238d

Please sign in to comment.