Skip to content

Commit d4371c1

Browse files
committed
Add obfuscation support
Signed-off-by: Riddhesh Sanghvi <[email protected]>
1 parent 99b3daa commit d4371c1

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

php/class-ee-docker.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,17 +201,18 @@ public static function docker_compose_up( $dir, $services = [] ) {
201201
/**
202202
* Function to exec and run commands into the containers.
203203
*
204-
* @param string $command Command to exec.
205-
* @param string $service Service to exec command into.
206-
* @param string $shell Shell in which exec command will be executed.
207-
* @param string $user User to execute command into.
208-
* @param String $dir Path to docker-compose.yml.
209-
* @param bool $shell_wrapper If shell wrapper should be enabled or not.
210-
* @param bool $exit_on_error To exit or not on error.
204+
* @param string $command Command to exec.
205+
* @param string $service Service to exec command into.
206+
* @param string $shell Shell in which exec command will be executed.
207+
* @param string $user User to execute command into.
208+
* @param String $dir Path to docker-compose.yml.
209+
* @param bool $shell_wrapper If shell wrapper should be enabled or not.
210+
* @param bool $exit_on_error To exit or not on error.
211+
* @param array $exec_obfuscate Data to be obfuscated from log.
211212
*
212213
* @return bool success.
213214
*/
214-
public static function docker_compose_exec( $command = '', $service = '', $shell = 'sh', $user = '', $dir = '', $shell_wrapper = false, $exit_on_error = false ) {
215+
public static function docker_compose_exec( $command = '', $service = '', $shell = 'sh', $user = '', $dir = '', $shell_wrapper = false, $exit_on_error = false, $exec_obfuscate = [] ) {
215216

216217
if ( ! empty( $dir ) ) {
217218
$chdir_return_code = chdir( $dir );
@@ -230,9 +231,9 @@ public static function docker_compose_exec( $command = '', $service = '', $shell
230231
}
231232

232233
if ( $shell_wrapper ) {
233-
return EE::exec( \EE_DOCKER::docker_compose_with_custom() . " exec $tty $user_string $service $shell -c \"$command\"", true, true, [], $exit_on_error );
234+
return EE::exec( \EE_DOCKER::docker_compose_with_custom() . " exec $tty $user_string $service $shell -c \"$command\"", true, true, $exec_obfuscate, $exit_on_error );
234235
} else {
235-
return EE::exec( \EE_DOCKER::docker_compose_with_custom() . " exec $tty $user_string $service $command", true, true, [], $exit_on_error );
236+
return EE::exec( \EE_DOCKER::docker_compose_with_custom() . " exec $tty $user_string $service $command", true, true, $exec_obfuscate, $exit_on_error );
236237
}
237238

238239
}

0 commit comments

Comments
 (0)