You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/Command/ExApp/Register.php
+33-2Lines changed: 33 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,10 @@ protected function configure(): void {
55
55
$this->addOption('wait-finish', null, InputOption::VALUE_NONE, 'Wait until finish');
56
56
$this->addOption('silent', null, InputOption::VALUE_NONE, 'Do not print to console');
57
57
$this->addOption('test-deploy-mode', null, InputOption::VALUE_NONE, 'Test deploy mode with additional status checks and slightly different logic');
58
+
59
+
// Advanced deploy options
60
+
$this->addOption('env', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Optional deploy options (ENV_NAME=ENV_VALUE), passed to ExApp container as environment variables');
61
+
$this->addOption('mount', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Optional mount options (SRC_PATH:DST_PATH or SRC_PATH:DST_PATH:ro|rw), passed to ExApp container as volume mounts only if the app declares those variables in its info.xml');
58
62
}
59
63
60
64
protectedfunctionexecute(InputInterface$input, OutputInterface$output): int {
@@ -73,8 +77,35 @@ protected function execute(InputInterface $input, OutputInterface $output): int
73
77
$this->exAppService->unregisterExApp($appId);
74
78
}
75
79
80
+
$deployOptions = [];
81
+
$envs = $input->getOption('env') ?? [];
82
+
// Parse array of deploy options strings (ENV_NAME=ENV_VALUE) to array key => value
83
+
$envs = array_reduce($envs, function ($carry, $item) {
84
+
$parts = explode('=', $item, 2);
85
+
if (count($parts) === 2) {
86
+
$carry[$parts[0]] = $parts[1];
87
+
}
88
+
return$carry;
89
+
}, []);
90
+
$deployOptions['environment_variables'] = $envs;
91
+
92
+
$mounts = $input->getOption('mount') ?? [];
93
+
// Parse array of mount options strings (HOST_PATH:CONTAINER_PATH:ro|rw)
94
+
// to array of arrays ['source' => HOST_PATH, 'target' => CONTAINER_PATH, 'mode' => ro|rw]
95
+
$mounts = array_reduce($mounts, function ($carry, $item) {
0 commit comments