From 6ed6ca4aa4667faefe6005f81e4e2439bfc6be79 Mon Sep 17 00:00:00 2001 From: Michael Priest Date: Fri, 21 Jun 2024 01:23:25 +0930 Subject: [PATCH] Updates site secrets from the project on environment create. --- .../shp_orchestration/src/Service/Environment.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web/modules/custom/shepherd/shp_orchestration/src/Service/Environment.php b/web/modules/custom/shepherd/shp_orchestration/src/Service/Environment.php index 4b055cc4..cbab4368 100644 --- a/web/modules/custom/shepherd/shp_orchestration/src/Service/Environment.php +++ b/web/modules/custom/shepherd/shp_orchestration/src/Service/Environment.php @@ -127,6 +127,14 @@ public function created(NodeInterface $node) { } $environment_type = $this->environmentService->getEnvironmentType($node); + // If there is a secret on the shepherd project, update it from project. + if ($secretName = $project->field_shp_secrets->value) { + // But still need to ensure it actually exists. + if ($secret = $this->orchestrationProviderPlugin->getSecret(0, $secretName)) { + $this->orchestrationProviderPlugin->updateSecret($site->id(), $secretName, $secret); + } + } + $probes = $this->buildProbes($project); $cron_jobs = $this->buildCronJobs($node);