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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user