refactor(environment): remove 'is_build_time' attribute from environment variable handling across the application to simplify configuration
This commit is contained in:
@@ -738,14 +738,6 @@ class Application extends BaseModel
|
||||
->where('key', 'not like', 'NIXPACKS_%');
|
||||
}
|
||||
|
||||
public function build_environment_variables()
|
||||
{
|
||||
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
|
||||
->where('is_preview', false)
|
||||
->where('is_build_time', true)
|
||||
->where('key', 'not like', 'NIXPACKS_%');
|
||||
}
|
||||
|
||||
public function nixpacks_environment_variables()
|
||||
{
|
||||
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
|
||||
@@ -767,14 +759,6 @@ class Application extends BaseModel
|
||||
->where('key', 'not like', 'NIXPACKS_%');
|
||||
}
|
||||
|
||||
public function build_environment_variables_preview()
|
||||
{
|
||||
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
|
||||
->where('is_preview', true)
|
||||
->where('is_build_time', true)
|
||||
->where('key', 'not like', 'NIXPACKS_%');
|
||||
}
|
||||
|
||||
public function nixpacks_environment_variables_preview()
|
||||
{
|
||||
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
|
||||
@@ -936,9 +920,9 @@ class Application extends BaseModel
|
||||
{
|
||||
$newConfigHash = base64_encode($this->fqdn.$this->git_repository.$this->git_branch.$this->git_commit_sha.$this->build_pack.$this->static_image.$this->install_command.$this->build_command.$this->start_command.$this->ports_exposes.$this->ports_mappings.$this->base_directory.$this->publish_directory.$this->dockerfile.$this->dockerfile_location.$this->custom_labels.$this->custom_docker_run_options.$this->dockerfile_target_build.$this->redirect.$this->custom_nginx_configuration.$this->custom_labels);
|
||||
if ($this->pull_request_id === 0 || $this->pull_request_id === null) {
|
||||
$newConfigHash .= json_encode($this->environment_variables()->get(['value', 'is_build_time', 'is_multiline', 'is_literal'])->sort());
|
||||
$newConfigHash .= json_encode($this->environment_variables()->get(['value', 'is_multiline', 'is_literal'])->sort());
|
||||
} else {
|
||||
$newConfigHash .= json_encode($this->environment_variables_preview->get(['value', 'is_build_time', 'is_multiline', 'is_literal'])->sort());
|
||||
$newConfigHash .= json_encode($this->environment_variables_preview->get(['value', 'is_multiline', 'is_literal'])->sort());
|
||||
}
|
||||
$newConfigHash = md5($newConfigHash);
|
||||
$oldConfigHash = data_get($this, 'config_hash');
|
||||
|
||||
@@ -14,7 +14,6 @@ use OpenApi\Attributes as OA;
|
||||
'uuid' => ['type' => 'string'],
|
||||
'resourceable_type' => ['type' => 'string'],
|
||||
'resourceable_id' => ['type' => 'integer'],
|
||||
'is_build_time' => ['type' => 'boolean'],
|
||||
'is_literal' => ['type' => 'boolean'],
|
||||
'is_multiline' => ['type' => 'boolean'],
|
||||
'is_preview' => ['type' => 'boolean'],
|
||||
@@ -35,7 +34,6 @@ class EnvironmentVariable extends BaseModel
|
||||
protected $casts = [
|
||||
'key' => 'string',
|
||||
'value' => 'encrypted',
|
||||
'is_build_time' => 'boolean',
|
||||
'is_multiline' => 'boolean',
|
||||
'is_preview' => 'boolean',
|
||||
'version' => 'string',
|
||||
@@ -61,7 +59,6 @@ class EnvironmentVariable extends BaseModel
|
||||
ModelsEnvironmentVariable::create([
|
||||
'key' => $environment_variable->key,
|
||||
'value' => $environment_variable->value,
|
||||
'is_build_time' => $environment_variable->is_build_time,
|
||||
'is_multiline' => $environment_variable->is_multiline ?? false,
|
||||
'is_literal' => $environment_variable->is_literal ?? false,
|
||||
'resourceable_type' => Application::class,
|
||||
|
||||
@@ -1113,7 +1113,6 @@ class Service extends BaseModel
|
||||
$this->environment_variables()->create([
|
||||
'key' => $key,
|
||||
'value' => $value,
|
||||
'is_build_time' => false,
|
||||
'resourceable_id' => $this->id,
|
||||
'resourceable_type' => $this->getMorphClass(),
|
||||
'is_preview' => false,
|
||||
|
||||
Reference in New Issue
Block a user