feat(environment): introduce 'is_buildtime_only' attribute to environment variables for improved build-time configuration

This commit is contained in:
Andras Bacsai
2025-09-11 17:38:16 +02:00
parent 6d477ff593
commit 20ad2165e7
9 changed files with 83 additions and 2 deletions

View File

@@ -23,6 +23,8 @@ class Add extends Component
public bool $is_literal = false;
public bool $is_buildtime_only = false;
protected $listeners = ['clearAddEnv' => 'clear'];
protected $rules = [
@@ -30,6 +32,7 @@ class Add extends Component
'value' => 'nullable',
'is_multiline' => 'required|boolean',
'is_literal' => 'required|boolean',
'is_buildtime_only' => 'required|boolean',
];
protected $validationAttributes = [
@@ -37,6 +40,7 @@ class Add extends Component
'value' => 'value',
'is_multiline' => 'multiline',
'is_literal' => 'literal',
'is_buildtime_only' => 'buildtime only',
];
public function mount()
@@ -52,6 +56,7 @@ class Add extends Component
'value' => $this->value,
'is_multiline' => $this->is_multiline,
'is_literal' => $this->is_literal,
'is_buildtime_only' => $this->is_buildtime_only,
'is_preview' => $this->is_preview,
]);
$this->clear();
@@ -63,5 +68,6 @@ class Add extends Component
$this->value = '';
$this->is_multiline = false;
$this->is_literal = false;
$this->is_buildtime_only = false;
}
}

View File

@@ -214,6 +214,7 @@ class All extends Component
$environment->value = $data['value'];
$environment->is_multiline = $data['is_multiline'] ?? false;
$environment->is_literal = $data['is_literal'] ?? false;
$environment->is_buildtime_only = $data['is_buildtime_only'] ?? false;
$environment->is_preview = $data['is_preview'] ?? false;
$environment->resourceable_id = $this->resource->id;
$environment->resourceable_type = $this->resource->getMorphClass();

View File

@@ -38,6 +38,8 @@ class Show extends Component
public bool $is_shown_once = false;
public bool $is_buildtime_only = false;
public bool $is_required = false;
public bool $is_really_required = false;
@@ -56,6 +58,7 @@ class Show extends Component
'is_multiline' => 'required|boolean',
'is_literal' => 'required|boolean',
'is_shown_once' => 'required|boolean',
'is_buildtime_only' => 'required|boolean',
'real_value' => 'nullable',
'is_required' => 'required|boolean',
];
@@ -99,6 +102,7 @@ class Show extends Component
} else {
$this->validate();
$this->env->is_required = $this->is_required;
$this->env->is_buildtime_only = $this->is_buildtime_only;
$this->env->is_shared = $this->is_shared;
}
$this->env->key = $this->key;
@@ -113,6 +117,7 @@ class Show extends Component
$this->is_multiline = $this->env->is_multiline;
$this->is_literal = $this->env->is_literal;
$this->is_shown_once = $this->env->is_shown_once;
$this->is_buildtime_only = $this->env->is_buildtime_only ?? false;
$this->is_required = $this->env->is_required ?? false;
$this->is_really_required = $this->env->is_really_required ?? false;
$this->is_shared = $this->env->is_shared ?? false;