diff --git a/app/Api/V1/Controllers/System/CronController.php b/app/Api/V1/Controllers/System/CronController.php index 941211efbd..7fa41e4c7a 100644 --- a/app/Api/V1/Controllers/System/CronController.php +++ b/app/Api/V1/Controllers/System/CronController.php @@ -50,7 +50,7 @@ class CronController extends Controller $return = []; $return['recurring_transactions'] = $this->runRecurring($config['force'], $config['date']); $return['auto_budgets'] = $this->runAutoBudget($config['force'], $config['date']); - if (true === config('cer.download_enabled')) { + if (true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data) { $return['exchange_rates'] = $this->exchangeRatesCronJob($config['force'], $config['date']); } $return['bill_notifications'] = $this->billWarningCronJob($config['force'], $config['date']); diff --git a/app/Api/V1/Controllers/Webhook/AttemptController.php b/app/Api/V1/Controllers/Webhook/AttemptController.php index 2a8f949176..123f570a98 100644 --- a/app/Api/V1/Controllers/Webhook/AttemptController.php +++ b/app/Api/V1/Controllers/Webhook/AttemptController.php @@ -71,7 +71,7 @@ class AttemptController extends Controller if ($message->webhook_id !== $webhook->id) { throw new FireflyException('200040: Webhook and webhook message are no match'); } - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User lists webhook attempts of webhook #%d and message #%d, but webhooks are DISABLED.', $webhook->id, $message->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -115,7 +115,7 @@ class AttemptController extends Controller throw new FireflyException('200041: Webhook message and webhook attempt are no match'); } - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User views single webhook attempt #%d of webhook #%d and message #%d, but webhooks are DISABLED', $attempt->id, $webhook->id, $message->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/DestroyController.php b/app/Api/V1/Controllers/Webhook/DestroyController.php index 98ee5f0586..1154ae2caa 100644 --- a/app/Api/V1/Controllers/Webhook/DestroyController.php +++ b/app/Api/V1/Controllers/Webhook/DestroyController.php @@ -63,7 +63,7 @@ class DestroyController extends Controller */ public function destroy(Webhook $webhook): JsonResponse { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d. but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -93,7 +93,7 @@ class DestroyController extends Controller throw new FireflyException('200041: Webhook message and webhook attempt are no match'); } - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d, message #%d, attempt #%d, but webhooks are DISABLED.', $webhook->id, $message->id, $attempt->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -121,7 +121,7 @@ class DestroyController extends Controller throw new FireflyException('200040: Webhook and webhook message are no match'); } - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d, message #%d, but webhooks are DISABLED.', $webhook->id, $message->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/MessageController.php b/app/Api/V1/Controllers/Webhook/MessageController.php index 475724f4c5..c9c404be5f 100644 --- a/app/Api/V1/Controllers/Webhook/MessageController.php +++ b/app/Api/V1/Controllers/Webhook/MessageController.php @@ -65,7 +65,7 @@ class MessageController extends Controller */ public function index(Webhook $webhook): JsonResponse { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User tries to view messages of webhook #%d, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -105,7 +105,7 @@ class MessageController extends Controller if ($message->webhook_id !== $webhook->id) { throw new FireflyException('200040: Webhook and webhook message are no match'); } - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User tries to view message #%d of webhook #%d, but webhooks are DISABLED.', $message->id, $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/ShowController.php b/app/Api/V1/Controllers/Webhook/ShowController.php index 62c39258b4..d33bbdbd84 100644 --- a/app/Api/V1/Controllers/Webhook/ShowController.php +++ b/app/Api/V1/Controllers/Webhook/ShowController.php @@ -72,7 +72,7 @@ class ShowController extends Controller */ public function index(): JsonResponse { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info('User tries to view all webhooks, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -114,7 +114,7 @@ class ShowController extends Controller */ public function show(Webhook $webhook): JsonResponse { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info(sprintf('User tries to view webhook #%d, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -146,7 +146,7 @@ class ShowController extends Controller */ public function triggerTransaction(Webhook $webhook, TransactionGroup $group): JsonResponse { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info(sprintf('User tries to trigger webhook #%d on transaction group #%d, but webhooks are DISABLED.', $webhook->id, $group->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/StoreController.php b/app/Api/V1/Controllers/Webhook/StoreController.php index 12c7b1bf75..25692f748c 100644 --- a/app/Api/V1/Controllers/Webhook/StoreController.php +++ b/app/Api/V1/Controllers/Webhook/StoreController.php @@ -63,7 +63,7 @@ class StoreController extends Controller public function store(CreateRequest $request): JsonResponse { $data = $request->getData(); - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info('User tries to store new webhook, but webhooks are DISABLED.', $data); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/SubmitController.php b/app/Api/V1/Controllers/Webhook/SubmitController.php index 034bea04b6..51cdb6c70e 100644 --- a/app/Api/V1/Controllers/Webhook/SubmitController.php +++ b/app/Api/V1/Controllers/Webhook/SubmitController.php @@ -58,7 +58,7 @@ class SubmitController extends Controller */ public function submit(Webhook $webhook): JsonResponse { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info(sprintf('User tries to submit webhook #%d, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/UpdateController.php b/app/Api/V1/Controllers/Webhook/UpdateController.php index c8da474ff4..5b6c7067b7 100644 --- a/app/Api/V1/Controllers/Webhook/UpdateController.php +++ b/app/Api/V1/Controllers/Webhook/UpdateController.php @@ -63,7 +63,7 @@ class UpdateController extends Controller public function update(Webhook $webhook, UpdateRequest $request): JsonResponse { $data = $request->getData(); - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info(sprintf('User tries to update webhook #%d, but webhooks are DISABLED.', $webhook->id), $data); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Requests/Models/Transaction/StoreRequest.php b/app/Api/V1/Requests/Models/Transaction/StoreRequest.php index 22fc2030b8..223e8ab7bb 100644 --- a/app/Api/V1/Requests/Models/Transaction/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Transaction/StoreRequest.php @@ -176,7 +176,7 @@ class StoreRequest extends FormRequest public function rules(): array { Log::debug('Collect rules of TransactionStoreRequest'); - $validProtocols = config('firefly.valid_url_protocols'); + $validProtocols = \FireflyIII\Support\Facades\FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; $locationRules = Location::requestRules([]); return [ diff --git a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php index fbde30a61b..1f674da33f 100644 --- a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php @@ -248,7 +248,7 @@ class UpdateRequest extends FormRequest public function rules(): array { Log::debug(sprintf('Now in %s', __METHOD__)); - $validProtocols = config('firefly.valid_url_protocols'); + $validProtocols = \FireflyIII\Support\Facades\FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; return [ // basic fields for group: diff --git a/app/Api/V1/Requests/Models/Webhook/CreateRequest.php b/app/Api/V1/Requests/Models/Webhook/CreateRequest.php index a0b66b50a2..5b059648c5 100644 --- a/app/Api/V1/Requests/Models/Webhook/CreateRequest.php +++ b/app/Api/V1/Requests/Models/Webhook/CreateRequest.php @@ -73,7 +73,7 @@ class CreateRequest extends FormRequest $triggers = implode(',', array_values(Webhook::getTriggers())); $responses = implode(',', array_values(Webhook::getResponses())); $deliveries = implode(',', array_values(Webhook::getDeliveries())); - $validProtocols = config('firefly.valid_url_protocols'); + $validProtocols = \FireflyIII\Support\Facades\FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; return [ 'title' => 'required|min:1|max:255|uniqueObjectForUser:webhooks,title', diff --git a/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php b/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php index 07dcf74b0c..e7b5a3d661 100644 --- a/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php @@ -73,7 +73,7 @@ class UpdateRequest extends FormRequest $triggers = implode(',', array_values(Webhook::getTriggers())); $responses = implode(',', array_values(Webhook::getResponses())); $deliveries = implode(',', array_values(Webhook::getDeliveries())); - $validProtocols = config('firefly.valid_url_protocols'); + $validProtocols = \FireflyIII\Support\Facades\FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; /** @var Webhook $webhook */ $webhook = $this->route()->parameter('webhook'); diff --git a/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php b/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php index bfb7ed2007..f9150c55bc 100644 --- a/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php +++ b/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php @@ -62,7 +62,7 @@ class CorrectsPrimaryCurrencyAmounts extends Command */ public function handle(): int { - if (false === config('cer.enabled')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data) { $this->friendlyInfo('This command will not run because currency exchange rates are disabled.'); return 0; diff --git a/app/Console/Commands/Correction/CorrectsUnevenAmount.php b/app/Console/Commands/Correction/CorrectsUnevenAmount.php index d96f2b6599..d5fef32fe2 100644 --- a/app/Console/Commands/Correction/CorrectsUnevenAmount.php +++ b/app/Console/Commands/Correction/CorrectsUnevenAmount.php @@ -30,6 +30,7 @@ use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\Support\Facades\Steam; use FireflyIII\Support\Models\AccountBalanceCalculator; use Illuminate\Console\Command; @@ -60,7 +61,7 @@ class CorrectsUnevenAmount extends Command $this->fixUnevenAmounts(); $this->matchCurrencies(); - if (true === config('firefly.feature_flags.running_balance_column')) { + if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) { $this->friendlyInfo('Will recalculate transaction running balance columns. This may take a LONG time. Please be patient.'); AccountBalanceCalculator::recalculateAll(false); $this->friendlyInfo('Done recalculating transaction running balance columns.'); diff --git a/app/Console/Commands/System/RecalculatesRunningBalance.php b/app/Console/Commands/System/RecalculatesRunningBalance.php index f14bba0ee7..4453e1e50d 100644 --- a/app/Console/Commands/System/RecalculatesRunningBalance.php +++ b/app/Console/Commands/System/RecalculatesRunningBalance.php @@ -52,7 +52,7 @@ class RecalculatesRunningBalance extends Command */ public function handle(): int { - if (true === config('firefly.feature_flags.running_balance_column')) { + if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) { $this->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.'); $this->correctBalanceAmounts($this->option('force')); $this->friendlyInfo('Done recalculating account balances.'); diff --git a/app/Console/Commands/Tools/Cron.php b/app/Console/Commands/Tools/Cron.php index ec91c4ebde..9348ac95b5 100644 --- a/app/Console/Commands/Tools/Cron.php +++ b/app/Console/Commands/Tools/Cron.php @@ -72,7 +72,7 @@ class Cron extends Command $force = (bool) $this->option('force'); // @phpstan-ignore-line // Fire exchange rates cron job. - if (true === config('cer.download_enabled') && ($doAll || $this->option('download-cer'))) { + if (true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data && ($doAll || $this->option('download-cer'))) { try { $this->exchangeRatesCronJob($force, $date); } catch (FireflyException $e) { diff --git a/app/Console/Commands/Upgrade/RepairsAccountBalances.php b/app/Console/Commands/Upgrade/RepairsAccountBalances.php index 88a5a040d3..28a0354559 100644 --- a/app/Console/Commands/Upgrade/RepairsAccountBalances.php +++ b/app/Console/Commands/Upgrade/RepairsAccountBalances.php @@ -43,7 +43,7 @@ class RepairsAccountBalances extends Command return 0; } - if (true === config('firefly.feature_flags.running_balance_column')) { + if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) { $this->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.'); $this->markAsExecuted(); $this->correctBalanceAmounts(); diff --git a/app/Handlers/Events/WebhookEventHandler.php b/app/Handlers/Events/WebhookEventHandler.php index 41f5d1ccf8..db1a25fd44 100644 --- a/app/Handlers/Events/WebhookEventHandler.php +++ b/app/Handlers/Events/WebhookEventHandler.php @@ -39,7 +39,7 @@ class WebhookEventHandler public function sendWebhookMessages(): void { Log::debug(sprintf('Now in %s', __METHOD__)); - if (false === config('firefly.feature_flags.webhooks') || false === config('firefly.allow_webhooks')) { + if (false === config('firefly.feature_flags.webhooks') || false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::debug('Webhook event handler is disabled, do not run sendWebhookMessages().'); return; diff --git a/app/Handlers/Observer/TransactionObserver.php b/app/Handlers/Observer/TransactionObserver.php index dc34b29e61..bca1eb866f 100644 --- a/app/Handlers/Observer/TransactionObserver.php +++ b/app/Handlers/Observer/TransactionObserver.php @@ -39,7 +39,7 @@ class TransactionObserver public function created(Transaction $transaction): void { Log::debug('Observe "created" of a transaction.'); - if (true === config('firefly.feature_flags.running_balance_column') && (1 === bccomp($transaction->amount, '0') && self::$recalculate)) { + if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data && (1 === bccomp($transaction->amount, '0') && self::$recalculate)) { Log::debug('Trigger recalculateForJournal'); AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal); } @@ -82,7 +82,7 @@ class TransactionObserver public function updated(Transaction $transaction): void { // Log::debug('Observe "updated" of a transaction.'); - if (true === config('firefly.feature_flags.running_balance_column') && self::$recalculate && 1 === bccomp($transaction->amount, '0')) { + if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data && self::$recalculate && 1 === bccomp($transaction->amount, '0')) { Log::debug('Trigger recalculateForJournal'); AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal); } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index dd80fec692..2fd0076d0e 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -80,7 +80,7 @@ abstract class Controller extends BaseController View::share('FF_BUILD_TIME', config('firefly.build_time')); // is webhooks enabled? - View::share('featuringWebhooks', true === config('firefly.feature_flags.webhooks') && true === config('firefly.allow_webhooks')); + View::share('featuringWebhooks', true === config('firefly.feature_flags.webhooks') && true === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data); // share custom auth guard info. $authGuard = config('firefly.authentication_guard'); diff --git a/app/Http/Controllers/ExchangeRates/IndexController.php b/app/Http/Controllers/ExchangeRates/IndexController.php index e8dbf13382..a83737a21a 100644 --- a/app/Http/Controllers/ExchangeRates/IndexController.php +++ b/app/Http/Controllers/ExchangeRates/IndexController.php @@ -47,7 +47,7 @@ class IndexController extends Controller return $next($request); } ); - if (false === config('cer.enabled')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data) { throw new NotFoundHttpException(); } } diff --git a/app/Http/Controllers/Transaction/CreateController.php b/app/Http/Controllers/Transaction/CreateController.php index 878e589c04..80e26160ab 100644 --- a/app/Http/Controllers/Transaction/CreateController.php +++ b/app/Http/Controllers/Transaction/CreateController.php @@ -140,7 +140,7 @@ class CreateController extends Controller ]; $optionalFields['external_url'] ??= false; $optionalFields['location'] ??= false; - $optionalFields['location'] = $optionalFields['location'] && true === config('firefly.enable_external_map'); + $optionalFields['location'] = $optionalFields['location'] && true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_external_map', config('firefly.enable_external_map'))->data; // map info: $longitude = config('firefly.default_location.longitude'); diff --git a/app/Http/Controllers/Transaction/EditController.php b/app/Http/Controllers/Transaction/EditController.php index a217962960..e1332c67da 100644 --- a/app/Http/Controllers/Transaction/EditController.php +++ b/app/Http/Controllers/Transaction/EditController.php @@ -114,7 +114,7 @@ class EditController extends Controller ]; $optionalFields['external_url'] ??= false; $optionalFields['location'] ??= false; - $optionalFields['location'] = $optionalFields['location'] && true === config('firefly.enable_external_map'); + $optionalFields['location'] = $optionalFields['location'] && true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_external_map', config('firefly.enable_external_map'))->data; // map info voor v2: $longitude = config('firefly.default_location.longitude'); diff --git a/app/Http/Controllers/Webhooks/CreateController.php b/app/Http/Controllers/Webhooks/CreateController.php index 6d84d4bbd1..d25cd8e0fa 100644 --- a/app/Http/Controllers/Webhooks/CreateController.php +++ b/app/Http/Controllers/Webhooks/CreateController.php @@ -59,7 +59,7 @@ class CreateController extends Controller */ public function index(): Factory|\Illuminate\Contracts\View\View { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning('User visits webhook create page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Http/Controllers/Webhooks/DeleteController.php b/app/Http/Controllers/Webhooks/DeleteController.php index 472a4826d5..055d6bc661 100644 --- a/app/Http/Controllers/Webhooks/DeleteController.php +++ b/app/Http/Controllers/Webhooks/DeleteController.php @@ -64,7 +64,7 @@ class DeleteController extends Controller */ public function index(Webhook $webhook): Factory|View { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning('User visits webhook delete page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Http/Controllers/Webhooks/EditController.php b/app/Http/Controllers/Webhooks/EditController.php index fd6c8e377d..b8ad6bf40b 100644 --- a/app/Http/Controllers/Webhooks/EditController.php +++ b/app/Http/Controllers/Webhooks/EditController.php @@ -63,7 +63,7 @@ class EditController extends Controller */ public function index(Webhook $webhook): Factory|View { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning('User visits webhook edit page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Http/Controllers/Webhooks/IndexController.php b/app/Http/Controllers/Webhooks/IndexController.php index 14ae4b279b..f264c59556 100644 --- a/app/Http/Controllers/Webhooks/IndexController.php +++ b/app/Http/Controllers/Webhooks/IndexController.php @@ -55,7 +55,7 @@ class IndexController extends Controller */ public function index(): Factory|\Illuminate\Contracts\View\View { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning('User visits webhook index page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Http/Controllers/Webhooks/ShowController.php b/app/Http/Controllers/Webhooks/ShowController.php index 051f6651ea..4de27b139b 100644 --- a/app/Http/Controllers/Webhooks/ShowController.php +++ b/app/Http/Controllers/Webhooks/ShowController.php @@ -63,7 +63,7 @@ class ShowController extends Controller */ public function index(Webhook $webhook): Factory|View { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User visits webhook #%d page, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Support/Amount.php b/app/Support/Amount.php index ad117d2a39..5bb7815df0 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -117,7 +117,7 @@ class Amount if (!$user instanceof User) { $pref = $instance->getPreference('convert_to_primary_no_user'); if (null === $pref) { - $res = true === Preferences::get('convert_to_primary', false)->data && true === config('cer.enabled'); + $res = true === Preferences::get('convert_to_primary', false)->data && true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data; $instance->setPreference('convert_to_primary_no_user', $res); return $res; @@ -128,7 +128,7 @@ class Amount $key = sprintf('convert_to_primary_%d', $user->id); $pref = $instance->getPreference($key); if (null === $pref) { - $res = true === Preferences::getForUser($user, 'convert_to_primary', false)->data && true === config('cer.enabled'); + $res = true === Preferences::getForUser($user, 'convert_to_primary', false)->data && true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data; $instance->setPreference($key, $res); return $res; diff --git a/app/Support/Http/Api/ExchangeRateConverter.php b/app/Support/Http/Api/ExchangeRateConverter.php index deb9457f58..5fb488d223 100644 --- a/app/Support/Http/Api/ExchangeRateConverter.php +++ b/app/Support/Http/Api/ExchangeRateConverter.php @@ -71,7 +71,7 @@ class ExchangeRateConverter public function enabled(): bool { - return false !== config('cer.enabled') || $this->ignoreSettings; + return false !== \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data || $this->ignoreSettings; } /** diff --git a/config/cer.php b/config/cer.php index 5f358897fd..e1e5508a6e 100644 --- a/config/cer.php +++ b/config/cer.php @@ -24,8 +24,8 @@ declare(strict_types=1); return [ 'url' => 'https://ff3exchangerates.z6.web.core.windows.net', - 'enabled' => env('ENABLE_EXCHANGE_RATES', false), - 'download_enabled' => env('ENABLE_EXTERNAL_RATES', false), + 'enabled' => env('ENABLE_EXCHANGE_RATES', false), // no longer used, is the default. + 'download_enabled' => env('ENABLE_EXTERNAL_RATES', false), // no longer used, only for default. // if currencies are added, default rates must be added as well! // source: https://www.xe.com/currencyconverter/ diff --git a/config/firefly.php b/config/firefly.php index 9522bf9cf7..9cde0fef73 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -75,7 +75,7 @@ return [ 'webhooks' => true, 'handle_debts' => true, 'expression_engine' => true, - 'running_balance_column' => env('USE_RUNNING_BALANCE', false), + 'running_balance_column' => env('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. // see cer.php for exchange rates feature flag. ], 'version' => 'develop/2025-12-19', @@ -94,10 +94,10 @@ return [ 'static_cron_token' => envNonEmpty('STATIC_CRON_TOKEN'), // flags - 'enable_external_map' => env('ENABLE_EXTERNAL_MAP', false), + 'enable_external_map' => env('ENABLE_EXTERNAL_MAP', false), // no longer used, only for default. 'disable_frame_header' => env('DISABLE_FRAME_HEADER', false), 'disable_csp_header' => env('DISABLE_CSP_HEADER', false), - 'allow_webhooks' => env('ALLOW_WEBHOOKS', false), + 'allow_webhooks' => env('ALLOW_WEBHOOKS', false), // no longer used, only for default. // info for demo site 'demo_username' => env('DEMO_USERNAME', ''), @@ -218,7 +218,7 @@ return [ 'available_dark_modes' => ['light', 'dark', 'browser'], 'bill_reminder_periods' => [90, 30, 14, 7, 0], 'valid_view_ranges' => ['1D', '1W', '1M', '3M', '6M', '1Y'], - 'valid_url_protocols' => envNonEmpty('VALID_URL_PROTOCOLS', 'http,https,ftp,ftps,mailto'), + 'valid_url_protocols' => envNonEmpty('VALID_URL_PROTOCOLS', 'http,https,ftp,ftps,mailto'), // no longer used, only for default. 'allowedMimes' => [ // plain files 'text/plain', diff --git a/resources/views/list/groups.twig b/resources/views/list/groups.twig index 58e217609a..92cfb0b960 100644 --- a/resources/views/list/groups.twig +++ b/resources/views/list/groups.twig @@ -33,7 +33,7 @@   {{ trans('list.description') }} {{ trans('list.amount') }} - {% if config('firefly.feature_flags.running_balance_column') %} + {% if FireflyConfig.get('use_running_balance', config('firefly.feature_flags.running_balance_column')) %} {{ trans('list.running_balance') }} {% endif %} {{ trans('list.date') }} @@ -266,7 +266,7 @@ {% endif %} {% endif %} - {% if config('firefly.feature_flags.running_balance_column') %} + {% if FireflyConfig.get('use_running_balance', config('firefly.feature_flags.running_balance_column')) %} {% if (null == transaction.balance_dirty or false == transaction.balance_dirty) and null != transaction.destination_balance_after and null != transaction.source_balance_after %} {% if transaction.transaction_type_type == 'Deposit' %} diff --git a/resources/views/partials/debug-table.twig b/resources/views/partials/debug-table.twig index a7404e9fb5..79eeed4364 100644 --- a/resources/views/partials/debug-table.twig +++ b/resources/views/partials/debug-table.twig @@ -119,11 +119,11 @@ Exchange rates - {% if config('cer.enabled') %}Enabled{% else %}Disabled{% endif %}, downloads {% if config('cer.download_enabled') %}enabled{% else %}disabled{% endif %} + {% if FireflyConfig.get('enable_exchange_rates', config('cer.enabled')) %}Enabled{% else %}Disabled{% endif %}, downloads {% if FireflyConfig.get('enable_external_rates', config('cer.download_enabled')) %}enabled{% else %}disabled{% endif %} RB-column - {% if config('firefly.feature_flags.running_balance_column') %}Enabled{% else %}Disabled{% endif %} + {% if FireflyConfig.get('use_running_balance', config('firefly.feature_flags.running_balance_column')) %}Enabled{% else %}Disabled{% endif %} diff --git a/resources/views/partials/menu-sidebar.twig b/resources/views/partials/menu-sidebar.twig index 5b262fc05d..8320682e98 100644 --- a/resources/views/partials/menu-sidebar.twig +++ b/resources/views/partials/menu-sidebar.twig @@ -226,7 +226,7 @@ {{ 'currencies'|_ }} - {% if config('cer.enabled') %} + {% if FireflyConfig.get('enable_exchange_rates', config('cer.enabled')) %}
  • diff --git a/resources/views/preferences/index.twig b/resources/views/preferences/index.twig index 2e7895d29d..62ccec7945 100644 --- a/resources/views/preferences/index.twig +++ b/resources/views/preferences/index.twig @@ -101,7 +101,7 @@ {# conversion back to primary currency #} - {% if config('cer.enabled') %} + {% if FireflyConfig.get('enable_exchange_rates', config('cer.enabled')) %}

    {{ 'pref_convert_to_primary'|_ }}