mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-14 08:18:08 +00:00
fix(railpack): query buildtime env vars directly instead of via computed attribute
Replace `railpack_environment_variables_collection()` helper (which returned pre-filtered Eloquent attribute collections) with inline queries on `environment_variables()` / `environment_variables_preview()` filtered by `is_buildtime`. This ensures Railpack build variables are sourced from the same query path as the rest of the deployment pipeline and avoids relying on a now-removed accessor that silently included all railpack vars regardless of build context.
This commit is contained in:
1 parent
ec71d33f5e
commit
ace643d3d8
2 files changed
+23
-16
No files matched your search
@@ -41,9 +41,10 @@ it('generates escaped railpack env args from resolved values and includes instal
|
||||
]);
|
||||
$nullValue->shouldReceive('getResolvedValueWithServer')->once()->with(Mockery::type(Server::class))->andReturn(null);
|
||||
|
||||
$application->shouldReceive('getAttribute')
|
||||
->with('railpack_environment_variables')
|
||||
->andReturn(collect([$nodeVersion, $literalValue, $jsonValue, $nullValue]));
|
||||
$envQuery = Mockery::mock();
|
||||
$envQuery->shouldReceive('where')->with('is_buildtime', true)->once()->andReturnSelf();
|
||||
$envQuery->shouldReceive('get')->once()->andReturn(collect([$nodeVersion, $literalValue, $jsonValue, $nullValue]));
|
||||
$application->shouldReceive('environment_variables')->once()->andReturn($envQuery);
|
||||
|
||||
$job = Mockery::mock(ApplicationDeploymentJob::class)->makePartial();
|
||||
$job->shouldAllowMockingProtectedMethods();
|
||||
@@ -94,9 +95,10 @@ it('uses preview railpack environment variables for preview deployments', functi
|
||||
]);
|
||||
$previewValue->shouldReceive('getResolvedValueWithServer')->once()->with(Mockery::type(Server::class))->andReturn('preview-value');
|
||||
|
||||
$application->shouldReceive('getAttribute')
|
||||
->with('railpack_environment_variables_preview')
|
||||
->andReturn(collect([$previewValue]));
|
||||
$previewQuery = Mockery::mock();
|
||||
$previewQuery->shouldReceive('where')->with('is_buildtime', true)->once()->andReturnSelf();
|
||||
$previewQuery->shouldReceive('get')->once()->andReturn(collect([$previewValue]));
|
||||
$application->shouldReceive('environment_variables_preview')->once()->andReturn($previewQuery);
|
||||
|
||||
$job = Mockery::mock(ApplicationDeploymentJob::class)->makePartial();
|
||||
$job->shouldAllowMockingProtectedMethods();
|
||||
|
||||
Reference in new issue
Block a user