@@ -26,12 +26,13 @@ async function safeExec(command: string): Promise<void> {
2626 throw error ;
2727 }
2828}
29-
29+ //! what if it is url or port
3030async function addScript (
3131 document : DfContentMap ,
3232 env_content : string ,
3333 static_content : string ,
3434 dockerfile_present : string ,
35+ volume_needed :string ,
3536 stack : string ,
3637 port : string ,
3738 build_cmds : string ,
@@ -40,7 +41,9 @@ async function addScript(
4041 const resource = shellEscape ( document . resource , "resource" ) ;
4142 const safePort = shellEscape ( port , "port" ) ;
4243 const memLimit = shellEscape ( MEMORY_LIMIT || "512m" , "MEMORY_LIMIT" ) ;
43-
44+ volume_needed = ( volume_needed == "Yes" ) . toString ( ) ;
45+ const volumeNeeded = shellEscape ( volume_needed , "false" ) ;
46+
4447 if ( document . resource_type === "URL" ) {
4548 await safeExec (
4649 `bash -c "echo 'bash ../../src/backend/shell_scripts/automate.sh -u ${ resource } ${ subdomain } ' > /hostpipe/pipe"` ,
@@ -52,19 +55,19 @@ async function addScript(
5255 } else if ( document . resource_type === "GITHUB" && static_content == "Yes" ) {
5356 await Deno . writeTextFile ( `/hostpipe/.env` , env_content ) ;
5457 await safeExec (
55- `bash -c "echo 'bash ../../src/backend/shell_scripts/container.sh -s ${ subdomain } ${ resource } 80 ${ memLimit } ' > /hostpipe/pipe"` ,
58+ `bash -c "echo 'bash ../../src/backend/shell_scripts/container.sh -s ${ subdomain } ${ resource } 80 ${ memLimit } ${ volumeNeeded } ' > /hostpipe/pipe"` ,
5659 ) ;
5760 } else if ( document . resource_type === "GITHUB" && static_content == "No" ) {
5861 if ( dockerfile_present === 'No' ) {
5962 await Deno . writeTextFile ( `/hostpipe/Dockerfile` , dockerize ( stack , safePort , build_cmds ) ) ;
6063 await Deno . writeTextFile ( `/hostpipe/.dockerignore` , dockerignore ( stack ) ) ;
6164 await Deno . writeTextFile ( `/hostpipe/.env` , env_content ) ;
6265 await safeExec (
63- `bash -c "echo 'bash ../../src/backend/shell_scripts/container.sh -g ${ subdomain } ${ resource } ${ safePort } ${ memLimit } ' > /hostpipe/pipe"` ,
66+ `bash -c "echo 'bash ../../src/backend/shell_scripts/container.sh -g ${ subdomain } ${ resource } ${ safePort } ${ memLimit } ${ volumeNeeded } ' > /hostpipe/pipe"` ,
6467 ) ;
6568 } else if ( dockerfile_present === 'Yes' ) {
6669 await safeExec (
67- `bash -c "echo 'bash ../../src/backend/shell_scripts/container.sh -d ${ subdomain } ${ resource } ${ safePort } ${ memLimit } ' > /hostpipe/pipe"` ,
70+ `bash -c "echo 'bash ../../src/backend/shell_scripts/container.sh -d ${ subdomain } ${ resource } ${ safePort } ${ memLimit } ${ volumeNeeded } ' > /hostpipe/pipe"` ,
6871 ) ;
6972 }
7073 }
0 commit comments