fix: not able to use other shared envs

This commit is contained in:
Andras Bacsai
2024-01-31 13:40:15 +01:00
parent 5f797ec0ae
commit 52fd7ad571
4 changed files with 34 additions and 2 deletions

View File

@@ -32,6 +32,13 @@ class Add extends Component
public function submit()
{
$this->validate();
if (str($this->value)->startsWith('{{') && str($this->value)->endsWith('}}')) {
$type = str($this->value)->after("{{")->before(".")->value;
if (!collect(['team', 'project', 'environment'])->contains($type)) {
$this->dispatch('error', 'Invalid shared variable type.', "Valid types are: team, project, environment.");
return;
}
}
$this->dispatch('saveKey', [
'key' => $this->key,
'value' => $this->value,