Update config, allow Beagle discover service to be disabled

This commit is contained in:
Daniel Supernault 2024-10-05 23:09:33 -06:00
parent 13f77a0fc7
commit de4ce3c83f
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1
2 changed files with 9 additions and 0 deletions

View file

@ -55,6 +55,10 @@ class BeagleService
return []; return [];
} }
if ((bool) config('instance.discover.beagle_api') == false) {
return [];
}
return Cache::remember(self::DISCOVER_CACHE_KEY, now()->addHours(6), function () { return Cache::remember(self::DISCOVER_CACHE_KEY, now()->addHours(6), function () {
try { try {
$res = Http::withOptions(['allow_redirects' => false]) $res = Http::withOptions(['allow_redirects' => false])
@ -92,6 +96,10 @@ class BeagleService
return []; return [];
} }
if ((bool) config('instance.discover.beagle_api') == false) {
return [];
}
return Cache::remember(self::DISCOVER_POSTS_CACHE_KEY, now()->addHours(1), function () { return Cache::remember(self::DISCOVER_POSTS_CACHE_KEY, now()->addHours(1), function () {
$posts = collect(self::getDiscover()) $posts = collect(self::getDiscover())
->filter(function ($post) { ->filter(function ($post) {

View file

@ -18,6 +18,7 @@ return [
'tags' => [ 'tags' => [
'is_public' => env('INSTANCE_PUBLIC_HASHTAGS', false), 'is_public' => env('INSTANCE_PUBLIC_HASHTAGS', false),
], ],
'beagle_api' => env('PF_INSTANCE_USE_BEAGLE_API', true),
], ],
'email' => env('INSTANCE_CONTACT_EMAIL'), 'email' => env('INSTANCE_CONTACT_EMAIL'),