Skip to content

Commit

Permalink
[#] 动态多站点env支持
Browse files Browse the repository at this point in the history
  • Loading branch information
WangNingkai committed Dec 24, 2020
1 parent 3e08575 commit 52e2770
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);

if (!$app->runningInConsole()) {
$envName = str_replace(['.', ':', '@'], '_', $_SERVER['HTTP_HOST']) . '.env';
if (file_exists(base_path("env/{$envName}"))) {
$app->useEnvironmentPath(
dirname(__DIR__) . '/env'
);
$app->loadEnvironmentFrom(
$envName
);
}
}

/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
Expand Down

0 comments on commit 52e2770

Please sign in to comment.