@@ -2928,7 +2928,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
2928
2928
}
2929
2929
2930
2930
$ parsedServices = collect ([]);
2931
- ray ()->clearAll ();
2931
+ // ray()->clearAll();
2932
2932
2933
2933
$ allMagicEnvironments = collect ([]);
2934
2934
foreach ($ services as $ serviceName => $ service ) {
@@ -3493,6 +3493,8 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
3493
3493
'is_build_time ' => false ,
3494
3494
'is_preview ' => false ,
3495
3495
]);
3496
+ // Add the variable to the environment so it will be shown in the deployable compose file
3497
+ $ environment [$ parsedKeyValue ->value ()] = $ resource ->environment_variables ()->where ('key ' , $ parsedKeyValue )->where ($ nameOfId , $ resource ->id )->first ()->value ;
3496
3498
3497
3499
continue ;
3498
3500
}
@@ -3586,10 +3588,14 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
3586
3588
if ($ environment ->count () > 0 ) {
3587
3589
$ environment = $ environment ->filter (function ($ value , $ key ) {
3588
3590
return ! str ($ key )->startsWith ('SERVICE_FQDN_ ' );
3589
- })->map (function ($ value , $ key ) {
3591
+ })->map (function ($ value , $ key ) use ( $ resource ) {
3590
3592
// 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
3593
if (str ($ value )->isEmpty ()) {
3592
- $ value = null ;
3594
+ if ($ resource ->environment_variables ()->where ('key ' , $ key )->exists ()) {
3595
+ $ value = $ resource ->environment_variables ()->where ('key ' , $ key )->first ()->value ;
3596
+ } else {
3597
+ $ value = null ;
3598
+ }
3593
3599
}
3594
3600
3595
3601
return $ value ;
0 commit comments