deployments wip

This commit is contained in:
2025-03-31 14:27:47 +00:00
parent d150f57c8f
commit 374ce90160
10 changed files with 147 additions and 22 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Data\Deployments;
class PlannedStep
{
protected string $script;
public function __construct(
public string $name = 'Step',
protected array $secrets = [],
string|callable $script = 'echo "Incomplete Step"',
) {
if (is_callable($script)) {
$this->script = $script();
} else {
$this->script = $script;
}
}
public function getSafeScript(): string
{
$script = $this->script;
foreach ($this->secrets as $key => $value) {
$script = str_replace("[!{$key}]", '********', $script);
}
return $script;
}
public function getScript(): string
{
$script = $this->script;
foreach ($this->secrets as $key => $value) {
$script = str_replace("[!{$key}]", $value, $script);
}
return $script;
}
}