mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 10:10:49 -04:00
fix: Add fallback for Codespace environment variables
Signed-off-by: Robin Windey <ro.windey@gmail.com>
This commit is contained in:
parent
cbc8033a44
commit
6bf4cfe049
1 changed files with 13 additions and 0 deletions
|
|
@ -7,6 +7,19 @@
|
|||
$codespaceName = getenv('CODESPACE_NAME');
|
||||
$codespaceDomain = getenv('GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN');
|
||||
|
||||
// When running under Apache, env vars from the shell profile are not inherited.
|
||||
// Fall back to the Codespaces shared environment file and the well-known domain.
|
||||
if (empty($codespaceName)) {
|
||||
$sharedEnvFile = '/workspaces/.codespaces/shared/environment-variables.json';
|
||||
if (is_readable($sharedEnvFile)) {
|
||||
$sharedEnv = json_decode(file_get_contents($sharedEnvFile), true) ?? [];
|
||||
$codespaceName = $sharedEnv['CODESPACE_NAME'] ?? '';
|
||||
}
|
||||
}
|
||||
if (!empty($codespaceName) && empty($codespaceDomain)) {
|
||||
$codespaceDomain = 'app.github.dev';
|
||||
}
|
||||
|
||||
$CONFIG = [
|
||||
'mail_from_address' => 'no-reply',
|
||||
'mail_smtpmode' => 'smtp',
|
||||
|
|
|
|||
Loading…
Reference in a new issue