Skip to content

Commit d57c9d8

Browse files
committed
feat: add elixir finetunes to the deployment job
1 parent c7c2924 commit d57c9d8

File tree

1 file changed

+47
-4
lines changed

1 file changed

+47
-4
lines changed

app/Jobs/ApplicationDeploymentJob.php

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,15 +1066,55 @@ private function save_environment_variables()
10661066
$this->environment_variables = $envs;
10671067
}
10681068

1069+
private function elixir_finetunes()
1070+
{
1071+
if ($this->pull_request_id === 0) {
1072+
$envType = 'environment_variables';
1073+
} else {
1074+
$envType = 'environment_variables_preview';
1075+
}
1076+
$mix_env = $this->application->{$envType}->where('key', 'MIX_ENV')->first();
1077+
if ($mix_env) {
1078+
if ($mix_env->is_build_time === false) {
1079+
$this->application_deployment_queue->addLogEntry('MIX_ENV environment variable is not set as build time.', type: 'error');
1080+
$this->application_deployment_queue->addLogEntry('Please set MIX_ENV environment variable to be build time variable if you facing any issues with the deployment.', type: 'error');
1081+
}
1082+
} else {
1083+
$this->application_deployment_queue->addLogEntry('MIX_ENV environment variable not found.', type: 'error');
1084+
$this->application_deployment_queue->addLogEntry('Please add MIX_ENV environment variable and set it to be build time variable if you facing any issues with the deployment.', type: 'error');
1085+
}
1086+
$secret_key_base = $this->application->{$envType}->where('key', 'SECRET_KEY_BASE')->first();
1087+
if ($secret_key_base) {
1088+
if ($secret_key_base->is_build_time === false) {
1089+
$this->application_deployment_queue->addLogEntry('SECRET_KEY_BASE environment variable is not set as build time.', type: 'error');
1090+
$this->application_deployment_queue->addLogEntry('Please set SECRET_KEY_BASE environment variable to be build time variable if you facing any issues with the deployment.', type: 'error');
1091+
}
1092+
} else {
1093+
$this->application_deployment_queue->addLogEntry('SECRET_KEY_BASE environment variable not found.', type: 'error');
1094+
$this->application_deployment_queue->addLogEntry('Please add SECRET_KEY_BASE environment variable and set it to be build time variable if you facing any issues with the deployment.', type: 'error');
1095+
}
1096+
$database_url = $this->application->{$envType}->where('key', 'DATABASE_URL')->first();
1097+
if ($database_url) {
1098+
if ($database_url->is_build_time === false) {
1099+
$this->application_deployment_queue->addLogEntry('DATABASE_URL environment variable is not set as build time.', type: 'error');
1100+
$this->application_deployment_queue->addLogEntry('Please set DATABASE_URL environment variable to be build time variable if you facing any issues with the deployment.', type: 'error');
1101+
}
1102+
} else {
1103+
$this->application_deployment_queue->addLogEntry('DATABASE_URL environment variable not found.', type: 'error');
1104+
$this->application_deployment_queue->addLogEntry('Please add DATABASE_URL environment variable and set it to be build time variable if you facing any issues with the deployment.', type: 'error');
1105+
}
1106+
}
1107+
10691108
private function laravel_finetunes()
10701109
{
10711110
if ($this->pull_request_id === 0) {
1072-
$nixpacks_php_fallback_path = $this->application->environment_variables->where('key', 'NIXPACKS_PHP_FALLBACK_PATH')->first();
1073-
$nixpacks_php_root_dir = $this->application->environment_variables->where('key', 'NIXPACKS_PHP_ROOT_DIR')->first();
1111+
$envType = 'environment_variables';
10741112
} else {
1075-
$nixpacks_php_fallback_path = $this->application->environment_variables_preview->where('key', 'NIXPACKS_PHP_FALLBACK_PATH')->first();
1076-
$nixpacks_php_root_dir = $this->application->environment_variables_preview->where('key', 'NIXPACKS_PHP_ROOT_DIR')->first();
1113+
$envType = 'environment_variables_preview';
10771114
}
1115+
$nixpacks_php_fallback_path = $this->application->{$envType}->where('key', 'NIXPACKS_PHP_FALLBACK_PATH')->first();
1116+
$nixpacks_php_root_dir = $this->application->{$envType}->where('key', 'NIXPACKS_PHP_ROOT_DIR')->first();
1117+
10781118
if (! $nixpacks_php_fallback_path) {
10791119
$nixpacks_php_fallback_path = new EnvironmentVariable;
10801120
$nixpacks_php_fallback_path->key = 'NIXPACKS_PHP_FALLBACK_PATH';
@@ -1533,6 +1573,9 @@ private function generate_nixpacks_confs()
15331573
data_set($parsed, 'variables.NIXPACKS_PHP_FALLBACK_PATH', $variables[0]->value);
15341574
data_set($parsed, 'variables.NIXPACKS_PHP_ROOT_DIR', $variables[1]->value);
15351575
}
1576+
if ($this->nixpacks_type === 'elixir') {
1577+
$this->elixir_finetunes();
1578+
}
15361579
$this->nixpacks_plan = json_encode($parsed, JSON_PRETTY_PRINT);
15371580
$this->application_deployment_queue->addLogEntry("Final Nixpacks plan: {$this->nixpacks_plan}", hidden: true);
15381581
if ($this->nixpacks_type === 'rust') {

0 commit comments

Comments
 (0)