Skip to content

Commit

Permalink
精简修复 lumen 加载配置
Browse files Browse the repository at this point in the history
  • Loading branch information
vanry committed Feb 25, 2020
1 parent eb2a037 commit 7c3b309
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/LumenServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,13 @@ class LumenServiceProvider extends TNTSearchScoutServiceProvider
*/
public function register()
{
$this->app->instance('path.config', $this->app->configPath());

$this->loadConfig('scout');
$this->loadConfig('tntsearch');
$this->configure('scout');
$this->configure('tntsearch');

$this->mergeConfigFrom(__DIR__.'/../config/tntsearch.php', 'tntsearch');
$this->app->instance('path.config', $this->app->configPath());

if ($this->app->runningInConsole()) {
$this->commands(ImportCommand::class);
}
}

protected function loadConfig($name)
{
if (file_exists($this->app->configPath("{$name}.php")) && ! $this->app->has($name)) {
$this->app->configure($name);
}
}
}

0 comments on commit 7c3b309

Please sign in to comment.