diff --git a/README.md b/README.md index 15faeb0..a51ec05 100644 --- a/README.md +++ b/README.md @@ -36,3 +36,10 @@ $app->register(PdAuth\PdAuthServiceProvider::class); ### 配置 +在项目 .env 文件中增加如下配置 + +``` +PDAUTH_APP_ID=appid +PDAUTH_SECRET=123456 +PDAUTH_HOST=http://auth.dev.haowumc.com +``` \ No newline at end of file diff --git a/src/PdAuth/PdAuthServiceProvider.php b/src/PdAuth/PdAuthServiceProvider.php index 35166ef..248d8bf 100644 --- a/src/PdAuth/PdAuthServiceProvider.php +++ b/src/PdAuth/PdAuthServiceProvider.php @@ -42,7 +42,7 @@ class PdAuthServiceProvider extends ServiceProvider protected function setupConfig() { - $source = realpath(__DIR__ . '/../config.php'); + $source = realpath(__DIR__ . '/../config/pdauth.php'); if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) { $this->publishes([$source => config_path('pdauth.php')], 'pdauth'); @@ -55,8 +55,8 @@ class PdAuthServiceProvider extends ServiceProvider public function register() { + $this->setupConfig(); $this->app->singleton('pd.auth', function () { - $this->app->configure('pdauth'); return new OAuth(config('pdauth')); }); }