Skip to content

Commit e429625

Browse files
feat: add updated scripts.ts
1 parent f41d606 commit e429625

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

src/backend/scripts.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,26 @@ async function addScript(
1010
port: string,
1111
build_cmds: string,
1212
) {
13-
if (document.resource_type === "URL") {
14-
await exec(
15-
`bash -c "echo 'bash ../../src/backend/utils/automate.sh -u ${document.resource} ${document.subdomain}' > /hostpipe/pipe"`,
16-
);
17-
} else if (document.resource_type === "PORT") {
18-
await exec(
19-
`bash -c "echo 'bash ../../src/backend/utils/automate.sh -p ${document.resource} ${document.subdomain}' > /hostpipe/pipe"`,
20-
);
21-
} else if (document.resource_type === "GITHUB" && static_content == "Yes") {
22-
await exec(
23-
`bash -c "echo 'bash ../../src/backend/utils/container.sh -s ${document.subdomain} ${document.resource} ${env_content}' > /hostpipe/pipe"`,
24-
);
25-
} else if (document.resource_type === "GITHUB" && static_content == "No") {
26-
const dockerfile = dockerize(stack, port, build_cmds);
27-
await exec(
28-
`bash -c "echo 'bash ../../src/backend/utils/container.sh -g ${document.subdomain} ${document.resource} ${env_content} ${dockerfile} ${port}' > /hostpipe/pipe"`,
29-
);
30-
}
13+
if (document.resource_type === "URL") {
14+
await exec(
15+
`bash -c "echo 'bash ../../src/backend/utils/automate.sh -u ${document.resource} ${document.subdomain}' > /hostpipe/pipe"`,
16+
);
17+
} else if (document.resource_type === "PORT") {
18+
await exec(
19+
`bash -c "echo 'bash ../../src/backend/utils/automate.sh -p ${document.resource} ${document.subdomain}' > /hostpipe/pipe"`,
20+
);
21+
} else if (document.resource_type === "GITHUB" && static_content == "Yes") {
22+
Deno.writeTextFile(`/hostpipe/.env`,env_content)
23+
await exec(
24+
`bash -c "echo 'bash ../../src/backend/utils/container.sh -s ${document.subdomain} ${document.resource}' > /hostpipe/pipe"`,
25+
);
26+
} else if (document.resource_type === "GITHUB" && static_content == "No") {
27+
let dockerfile = dockerize(stack, port, build_cmds);
28+
Deno.writeTextFile(`/hostpipe/Dockerfile`,dockerfile)
29+
Deno.writeTextFile(`/hostpipe/.env`,env_content)
30+
await exec(
31+
`bash -c "echo 'bash ../../src/backend/utils/container.sh -g ${document.subdomain} ${document.resource} ${port}' > /hostpipe/pipe"`);
32+
}
3133
}
3234

3335
async function deleteScript(document: DfContentMap) {

0 commit comments

Comments
 (0)