Skip to content

Commit 24a7f30

Browse files
committed
feature: Container mode support
1 parent 954868a commit 24a7f30

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

internal/sandbox/command_generator.go

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,27 @@ func GenerateCommand(extension *models.Extension, credentials *models.Credential
104104
soCommand = "-dextension=" + shellescape.Quote(soPath) + " "
105105
}
106106

107-
command := fmt.Sprintf(
108-
"runuser %s -c 'timeout %s /usr/bin/php %s -d display_errors=on %s %s %s'",
109-
strings.Replace(extension.ID, "-", "", -1),
110-
helpers.Env("EXTENSION_TIMEOUT", "30"),
111-
soCommand,
112-
constants.SANDBOX_PATH,
113-
constants.KEYS_PATH+"/"+extension.ID,
114-
encryptedData,
115-
)
107+
command := ""
108+
if helpers.Env("CONTAINER_MODE", "false") != "true" {
109+
command = fmt.Sprintf(
110+
"runuser %s -c 'timeout %s /usr/bin/php %s -d display_errors=on %s %s %s'",
111+
strings.Replace(extension.ID, "-", "", -1),
112+
helpers.Env("EXTENSION_TIMEOUT", "30"),
113+
soCommand,
114+
constants.SANDBOX_PATH,
115+
constants.KEYS_PATH+"/"+extension.ID,
116+
encryptedData,
117+
)
118+
} else {
119+
command = fmt.Sprintf(
120+
"runuser extuser -c 'timeout %s /usr/bin/php %s -d display_errors=on %s %s %s'",
121+
helpers.Env("EXTENSION_TIMEOUT", "30"),
122+
soCommand,
123+
constants.SANDBOX_PATH,
124+
constants.KEYS_PATH+"/"+extension.ID,
125+
encryptedData,
126+
)
127+
}
116128

117129
return command, nil
118130
}

0 commit comments

Comments
 (0)