1212namespace FoF \OAuth ;
1313
1414use Flarum \Foundation \AbstractServiceProvider ;
15+ use Flarum \Foundation \Config ;
1516use Flarum \Http \RouteCollection ;
1617use Flarum \Http \RouteHandlerFactory ;
1718use Illuminate \Contracts \Cache \Store as Cache ;
@@ -44,8 +45,15 @@ public function boot()
4445 {
4546 /** @var Cache $cache */
4647 $ cache = $ this ->container ->make (Cache::class);
48+ /** @var Config $config */
49+ $ config = $ this ->container ->make (Config::class);
50+
51+ $ this ->container ->singleton ('fof-oauth.providers.forum ' , function () use ($ cache , $ config ) {
52+ // If we're in debug mode, don't cache the providers, but directly return them.
53+ if ($ config ->inDebugMode ()) {
54+ return $ this ->mapProviders ();
55+ }
4756
48- $ this ->container ->singleton ('fof-oauth.providers.forum ' , function () use ($ cache ) {
4957 $ cacheKey = 'fof-oauth.providers.forum ' ;
5058
5159 $ data = $ cache ->get ($ cacheKey );
@@ -57,7 +65,12 @@ public function boot()
5765 return $ data ;
5866 });
5967
60- $ this ->container ->singleton ('fof-oauth.providers.admin ' , function () use ($ cache ) {
68+ $ this ->container ->singleton ('fof-oauth.providers.admin ' , function () use ($ cache , $ config ) {
69+ // If we're in debug mode, don't cache the providers, but directly return them.
70+ if ($ config ->inDebugMode ()) {
71+ return $ this ->mapProviders ();
72+ }
73+
6174 $ cacheKey = 'fof-oauth.providers.admin ' ;
6275
6376 $ data = $ cache ->get ($ cacheKey );
0 commit comments