feat(laravel): auto-set APP_URL from platform or custom domain

Inject APP_URL for Laravel/PHP apps when missing: on create from the
platform subdomain, on custom-domain verification from the verified host,
and at deploy time as a safety net. Never overwrites user-provided values.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
keyhan
2026-05-15 00:51:09 +03:30
parent b6c8996a2c
commit abd8848180
5 changed files with 157 additions and 4 deletions
+9 -3
View File
@@ -8,6 +8,7 @@ import { promisify } from 'util';
import { PassThrough } from 'stream';
import { ClustersService } from '../clusters/clusters.service';
import { Application } from '../applications/entities/application.entity';
import { ensureAppUrlEnv } from '../applications/app-url.util';
import { AppRuntime, DatabaseType, CustomDomainStatus } from '../common/enums';
import { HelmService } from './helm.service';
@@ -101,6 +102,11 @@ export class KubernetesService implements OnModuleInit {
/**
* Build Helm values object from an Application entity and image URI.
*/
private resolveEnvVars(app: Application): Record<string, string> {
const platformDomain = this.configService.get('platform.domain') || 'apps.cloudhost.ir';
return ensureAppUrlEnv(app, platformDomain);
}
private buildHelmValues(app: Application, imageUri: string): Record<string, any> {
const domain = this.configService.get('platform.domain');
const pullRegistryUrl = this.configService.get<string>('registry.pullUrl') || 'localhost:30500';
@@ -124,7 +130,7 @@ export class KubernetesService implements OnModuleInit {
memoryRequest: app.memoryRequest,
memoryLimit: app.memoryLimit,
},
envVars: app.envVars || {},
envVars: this.resolveEnvVars(app),
ingress: {
enabled: true,
subdomain: app.subdomain || app.name,
@@ -224,7 +230,7 @@ export class KubernetesService implements OnModuleInit {
cpuLimit: app.cpuLimit,
memoryRequest: app.memoryRequest,
memoryLimit: app.memoryLimit,
envVars: app.envVars || {},
envVars: this.resolveEnvVars(app),
runtime: app.runtime,
databaseType: app.databaseType,
domain,
@@ -282,7 +288,7 @@ export class KubernetesService implements OnModuleInit {
cpuLimit: app.cpuLimit,
memoryRequest: app.memoryRequest,
memoryLimit: app.memoryLimit,
envVars: app.envVars || {},
envVars: this.resolveEnvVars(app),
runtime: app.runtime,
databaseType: app.databaseType,
domain: domain,