From cbc842fb2906688f6b96122523c037ca0ac93c78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=80=99=E5=AD=A6=E6=9D=B0?= Date: Mon, 19 Mar 2018 11:53:36 +0800 Subject: [PATCH] config --- README.md | 7 +++++++ src/PdAuth/PdAuthServiceProvider.php | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) 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')); }); }