Fix: migrate-env-reverb liest Domain aus DB-Setting ui_domain als Fallback
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>main v1.1.295
parent
60ebd0ed16
commit
8fa28a4d84
|
|
@ -19,12 +19,19 @@ class MigrateEnvReverb extends Command
|
|||
|
||||
$content = file_get_contents($env);
|
||||
|
||||
// APP_HOST ermitteln – Fallback auf APP_URL
|
||||
// APP_HOST ermitteln: .env → APP_URL → DB-Setting ui_domain
|
||||
$appHost = $this->extractVar($content, 'APP_HOST');
|
||||
if (!$appHost) {
|
||||
if (!$appHost || preg_match('/^\d+\.\d+\.\d+\.\d+$/', $appHost)) {
|
||||
$appUrl = $this->extractVar($content, 'APP_URL');
|
||||
$appHost = parse_url($appUrl ?: '', PHP_URL_HOST) ?: '';
|
||||
}
|
||||
if (!$appHost || preg_match('/^\d+\.\d+\.\d+\.\d+$/', $appHost)) {
|
||||
try {
|
||||
$appHost = (string) \App\Models\Setting::get('ui_domain', '');
|
||||
} catch (\Throwable) {
|
||||
$appHost = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!$appHost || preg_match('/^\d+\.\d+\.\d+\.\d+$/', $appHost)) {
|
||||
$this->warn('Kein gültiger Hostname gefunden – Migration übersprungen.');
|
||||
|
|
@ -63,8 +70,23 @@ class MigrateEnvReverb extends Command
|
|||
}
|
||||
}
|
||||
|
||||
// APP_HOST setzen falls fehlend
|
||||
if (!$this->extractVar($content, 'APP_HOST')) {
|
||||
$content .= "\nAPP_HOST={$appHost}";
|
||||
}
|
||||
|
||||
file_put_contents($env, $content);
|
||||
$this->info("REVERB .env migriert für Host: {$appHost}");
|
||||
|
||||
// Assets neu bauen damit wsHost korrekt eingebacken wird
|
||||
$buildLog = base_path('../mailwolt-frontend-build.log');
|
||||
exec('cd ' . escapeshellarg(base_path()) . ' && npm run build --silent 2>/dev/null', $out, $rc);
|
||||
if ($rc !== 0) {
|
||||
$this->warn('npm run build fehlgeschlagen – bitte manuell ausführen.');
|
||||
} else {
|
||||
$this->info('Assets neu gebaut.');
|
||||
}
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue