@@ -3484,6 +3484,16 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
3484
3484
$ value = $ value ->after ('? ' );
3485
3485
}
3486
3486
if ($ originalValue ->value () === $ value ->value ()) {
3487
+ // This means the variable does not have a default value, so it needs to be created in Coolify
3488
+ $ parsedKeyValue = replaceVariables ($ value );
3489
+ $ resource ->environment_variables ()->where ('key ' , $ parsedKeyValue )->where ($ nameOfId , $ resource ->id )->firstOrCreate ([
3490
+ 'key ' => $ parsedKeyValue ,
3491
+ $ nameOfId => $ resource ->id ,
3492
+ ], [
3493
+ 'is_build_time ' => false ,
3494
+ 'is_preview ' => false ,
3495
+ ]);
3496
+
3487
3497
continue ;
3488
3498
}
3489
3499
$ resource ->environment_variables ()->where ('key ' , $ key )->where ($ nameOfId , $ resource ->id )->firstOrCreate ([
@@ -3576,6 +3586,13 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
3576
3586
if ($ environment ->count () > 0 ) {
3577
3587
$ environment = $ environment ->filter (function ($ value , $ key ) {
3578
3588
return ! str ($ key )->startsWith ('SERVICE_FQDN_ ' );
3589
+ })->map (function ($ value , $ key ) {
3590
+ // if value is empty, set it to null so if you set the environment variable in the .env file (Coolify's UI), it will used
3591
+ if (str ($ value )->isEmpty ()) {
3592
+ $ value = null ;
3593
+ }
3594
+
3595
+ return $ value ;
3579
3596
});
3580
3597
}
3581
3598
$ serviceLabels = $ labels ->merge ($ defaultLabels );
0 commit comments