Replace references to hard coded config with variables.

This commit is contained in:
James Cole
2025-12-20 07:00:53 +01:00
parent 0f0cdb8e96
commit 8e729d6bbf
36 changed files with 51 additions and 50 deletions

View File

@@ -50,7 +50,7 @@ class CronController extends Controller
$return = []; $return = [];
$return['recurring_transactions'] = $this->runRecurring($config['force'], $config['date']); $return['recurring_transactions'] = $this->runRecurring($config['force'], $config['date']);
$return['auto_budgets'] = $this->runAutoBudget($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['exchange_rates'] = $this->exchangeRatesCronJob($config['force'], $config['date']);
} }
$return['bill_notifications'] = $this->billWarningCronJob($config['force'], $config['date']); $return['bill_notifications'] = $this->billWarningCronJob($config['force'], $config['date']);

View File

@@ -71,7 +71,7 @@ class AttemptController extends Controller
if ($message->webhook_id !== $webhook->id) { if ($message->webhook_id !== $webhook->id) {
throw new FireflyException('200040: Webhook and webhook message are no match'); 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)); 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.'); 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'); 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)); 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.'); throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -63,7 +63,7 @@ class DestroyController extends Controller
*/ */
public function destroy(Webhook $webhook): JsonResponse 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)); Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d. but webhooks are DISABLED.', $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.'); 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'); 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)); 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.'); 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'); 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)); 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.'); throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -65,7 +65,7 @@ class MessageController extends Controller
*/ */
public function index(Webhook $webhook): JsonResponse 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)); 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.'); throw new NotFoundHttpException('Webhooks are not enabled.');
@@ -105,7 +105,7 @@ class MessageController extends Controller
if ($message->webhook_id !== $webhook->id) { if ($message->webhook_id !== $webhook->id) {
throw new FireflyException('200040: Webhook and webhook message are no match'); 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)); 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.'); throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -72,7 +72,7 @@ class ShowController extends Controller
*/ */
public function index(): JsonResponse 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.'); Log::channel('audit')->info('User tries to view all webhooks, but webhooks are DISABLED.');
throw new NotFoundHttpException('Webhooks are not enabled.'); throw new NotFoundHttpException('Webhooks are not enabled.');
@@ -114,7 +114,7 @@ class ShowController extends Controller
*/ */
public function show(Webhook $webhook): JsonResponse 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)); Log::channel('audit')->info(sprintf('User tries to view webhook #%d, but webhooks are DISABLED.', $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.'); throw new NotFoundHttpException('Webhooks are not enabled.');
@@ -146,7 +146,7 @@ class ShowController extends Controller
*/ */
public function triggerTransaction(Webhook $webhook, TransactionGroup $group): JsonResponse 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)); 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.'); throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -63,7 +63,7 @@ class StoreController extends Controller
public function store(CreateRequest $request): JsonResponse public function store(CreateRequest $request): JsonResponse
{ {
$data = $request->getData(); $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); Log::channel('audit')->info('User tries to store new webhook, but webhooks are DISABLED.', $data);
throw new NotFoundHttpException('Webhooks are not enabled.'); throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -58,7 +58,7 @@ class SubmitController extends Controller
*/ */
public function submit(Webhook $webhook): JsonResponse 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)); Log::channel('audit')->info(sprintf('User tries to submit webhook #%d, but webhooks are DISABLED.', $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.'); throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -63,7 +63,7 @@ class UpdateController extends Controller
public function update(Webhook $webhook, UpdateRequest $request): JsonResponse public function update(Webhook $webhook, UpdateRequest $request): JsonResponse
{ {
$data = $request->getData(); $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); 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.'); throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -176,7 +176,7 @@ class StoreRequest extends FormRequest
public function rules(): array public function rules(): array
{ {
Log::debug('Collect rules of TransactionStoreRequest'); 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([]); $locationRules = Location::requestRules([]);
return [ return [

View File

@@ -248,7 +248,7 @@ class UpdateRequest extends FormRequest
public function rules(): array public function rules(): array
{ {
Log::debug(sprintf('Now in %s', __METHOD__)); 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 [ return [
// basic fields for group: // basic fields for group:

View File

@@ -73,7 +73,7 @@ class CreateRequest extends FormRequest
$triggers = implode(',', array_values(Webhook::getTriggers())); $triggers = implode(',', array_values(Webhook::getTriggers()));
$responses = implode(',', array_values(Webhook::getResponses())); $responses = implode(',', array_values(Webhook::getResponses()));
$deliveries = implode(',', array_values(Webhook::getDeliveries())); $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 [ return [
'title' => 'required|min:1|max:255|uniqueObjectForUser:webhooks,title', 'title' => 'required|min:1|max:255|uniqueObjectForUser:webhooks,title',

View File

@@ -73,7 +73,7 @@ class UpdateRequest extends FormRequest
$triggers = implode(',', array_values(Webhook::getTriggers())); $triggers = implode(',', array_values(Webhook::getTriggers()));
$responses = implode(',', array_values(Webhook::getResponses())); $responses = implode(',', array_values(Webhook::getResponses()));
$deliveries = implode(',', array_values(Webhook::getDeliveries())); $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 */ /** @var Webhook $webhook */
$webhook = $this->route()->parameter('webhook'); $webhook = $this->route()->parameter('webhook');

View File

@@ -62,7 +62,7 @@ class CorrectsPrimaryCurrencyAmounts extends Command
*/ */
public function handle(): int 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.'); $this->friendlyInfo('This command will not run because currency exchange rates are disabled.');
return 0; return 0;

View File

@@ -30,6 +30,7 @@ use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Facades\FireflyConfig;
use FireflyIII\Support\Facades\Steam; use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Models\AccountBalanceCalculator; use FireflyIII\Support\Models\AccountBalanceCalculator;
use Illuminate\Console\Command; use Illuminate\Console\Command;
@@ -60,7 +61,7 @@ class CorrectsUnevenAmount extends Command
$this->fixUnevenAmounts(); $this->fixUnevenAmounts();
$this->matchCurrencies(); $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.'); $this->friendlyInfo('Will recalculate transaction running balance columns. This may take a LONG time. Please be patient.');
AccountBalanceCalculator::recalculateAll(false); AccountBalanceCalculator::recalculateAll(false);
$this->friendlyInfo('Done recalculating transaction running balance columns.'); $this->friendlyInfo('Done recalculating transaction running balance columns.');

View File

@@ -52,7 +52,7 @@ class RecalculatesRunningBalance extends Command
*/ */
public function handle(): int 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->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.');
$this->correctBalanceAmounts($this->option('force')); $this->correctBalanceAmounts($this->option('force'));
$this->friendlyInfo('Done recalculating account balances.'); $this->friendlyInfo('Done recalculating account balances.');

View File

@@ -72,7 +72,7 @@ class Cron extends Command
$force = (bool) $this->option('force'); // @phpstan-ignore-line $force = (bool) $this->option('force'); // @phpstan-ignore-line
// Fire exchange rates cron job. // 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 { try {
$this->exchangeRatesCronJob($force, $date); $this->exchangeRatesCronJob($force, $date);
} catch (FireflyException $e) { } catch (FireflyException $e) {

View File

@@ -43,7 +43,7 @@ class RepairsAccountBalances extends Command
return 0; 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->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.');
$this->markAsExecuted(); $this->markAsExecuted();
$this->correctBalanceAmounts(); $this->correctBalanceAmounts();

View File

@@ -39,7 +39,7 @@ class WebhookEventHandler
public function sendWebhookMessages(): void public function sendWebhookMessages(): void
{ {
Log::debug(sprintf('Now in %s', __METHOD__)); 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().'); Log::debug('Webhook event handler is disabled, do not run sendWebhookMessages().');
return; return;

View File

@@ -39,7 +39,7 @@ class TransactionObserver
public function created(Transaction $transaction): void public function created(Transaction $transaction): void
{ {
Log::debug('Observe "created" of a transaction.'); 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'); Log::debug('Trigger recalculateForJournal');
AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal); AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal);
} }
@@ -82,7 +82,7 @@ class TransactionObserver
public function updated(Transaction $transaction): void public function updated(Transaction $transaction): void
{ {
// Log::debug('Observe "updated" of a transaction.'); // 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'); Log::debug('Trigger recalculateForJournal');
AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal); AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal);
} }

View File

@@ -80,7 +80,7 @@ abstract class Controller extends BaseController
View::share('FF_BUILD_TIME', config('firefly.build_time')); View::share('FF_BUILD_TIME', config('firefly.build_time'));
// is webhooks enabled? // 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. // share custom auth guard info.
$authGuard = config('firefly.authentication_guard'); $authGuard = config('firefly.authentication_guard');

View File

@@ -47,7 +47,7 @@ class IndexController extends Controller
return $next($request); 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(); throw new NotFoundHttpException();
} }
} }

View File

@@ -140,7 +140,7 @@ class CreateController extends Controller
]; ];
$optionalFields['external_url'] ??= false; $optionalFields['external_url'] ??= false;
$optionalFields['location'] ??= 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: // map info:
$longitude = config('firefly.default_location.longitude'); $longitude = config('firefly.default_location.longitude');

View File

@@ -114,7 +114,7 @@ class EditController extends Controller
]; ];
$optionalFields['external_url'] ??= false; $optionalFields['external_url'] ??= false;
$optionalFields['location'] ??= 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: // map info voor v2:
$longitude = config('firefly.default_location.longitude'); $longitude = config('firefly.default_location.longitude');

View File

@@ -59,7 +59,7 @@ class CreateController extends Controller
*/ */
public function index(): Factory|\Illuminate\Contracts\View\View 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.'); Log::channel('audit')->warning('User visits webhook create page, but webhooks are DISABLED.');
throw new NotFoundHttpException('Webhooks are not enabled.'); throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -64,7 +64,7 @@ class DeleteController extends Controller
*/ */
public function index(Webhook $webhook): Factory|View 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.'); Log::channel('audit')->warning('User visits webhook delete page, but webhooks are DISABLED.');
throw new NotFoundHttpException('Webhooks are not enabled.'); throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -63,7 +63,7 @@ class EditController extends Controller
*/ */
public function index(Webhook $webhook): Factory|View 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.'); Log::channel('audit')->warning('User visits webhook edit page, but webhooks are DISABLED.');
throw new NotFoundHttpException('Webhooks are not enabled.'); throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -55,7 +55,7 @@ class IndexController extends Controller
*/ */
public function index(): Factory|\Illuminate\Contracts\View\View 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.'); Log::channel('audit')->warning('User visits webhook index page, but webhooks are DISABLED.');
throw new NotFoundHttpException('Webhooks are not enabled.'); throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -63,7 +63,7 @@ class ShowController extends Controller
*/ */
public function index(Webhook $webhook): Factory|View 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)); Log::channel('audit')->warning(sprintf('User visits webhook #%d page, but webhooks are DISABLED.', $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.'); throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -117,7 +117,7 @@ class Amount
if (!$user instanceof User) { if (!$user instanceof User) {
$pref = $instance->getPreference('convert_to_primary_no_user'); $pref = $instance->getPreference('convert_to_primary_no_user');
if (null === $pref) { 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); $instance->setPreference('convert_to_primary_no_user', $res);
return $res; return $res;
@@ -128,7 +128,7 @@ class Amount
$key = sprintf('convert_to_primary_%d', $user->id); $key = sprintf('convert_to_primary_%d', $user->id);
$pref = $instance->getPreference($key); $pref = $instance->getPreference($key);
if (null === $pref) { 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); $instance->setPreference($key, $res);
return $res; return $res;

View File

@@ -71,7 +71,7 @@ class ExchangeRateConverter
public function enabled(): bool 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;
} }
/** /**

View File

@@ -24,8 +24,8 @@ declare(strict_types=1);
return [ return [
'url' => 'https://ff3exchangerates.z6.web.core.windows.net', 'url' => 'https://ff3exchangerates.z6.web.core.windows.net',
'enabled' => env('ENABLE_EXCHANGE_RATES', false), 'enabled' => env('ENABLE_EXCHANGE_RATES', false), // no longer used, is the default.
'download_enabled' => env('ENABLE_EXTERNAL_RATES', false), 'download_enabled' => env('ENABLE_EXTERNAL_RATES', false), // no longer used, only for default.
// if currencies are added, default rates must be added as well! // if currencies are added, default rates must be added as well!
// source: https://www.xe.com/currencyconverter/ // source: https://www.xe.com/currencyconverter/

View File

@@ -75,7 +75,7 @@ return [
'webhooks' => true, 'webhooks' => true,
'handle_debts' => true, 'handle_debts' => true,
'expression_engine' => 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. // see cer.php for exchange rates feature flag.
], ],
'version' => 'develop/2025-12-19', 'version' => 'develop/2025-12-19',
@@ -94,10 +94,10 @@ return [
'static_cron_token' => envNonEmpty('STATIC_CRON_TOKEN'), 'static_cron_token' => envNonEmpty('STATIC_CRON_TOKEN'),
// flags // 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_frame_header' => env('DISABLE_FRAME_HEADER', false),
'disable_csp_header' => env('DISABLE_CSP_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 // info for demo site
'demo_username' => env('DEMO_USERNAME', ''), 'demo_username' => env('DEMO_USERNAME', ''),
@@ -218,7 +218,7 @@ return [
'available_dark_modes' => ['light', 'dark', 'browser'], 'available_dark_modes' => ['light', 'dark', 'browser'],
'bill_reminder_periods' => [90, 30, 14, 7, 0], 'bill_reminder_periods' => [90, 30, 14, 7, 0],
'valid_view_ranges' => ['1D', '1W', '1M', '3M', '6M', '1Y'], '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' => [ 'allowedMimes' => [
// plain files // plain files
'text/plain', 'text/plain',

View File

@@ -33,7 +33,7 @@
<th class="hidden-xs">&nbsp;</th> <th class="hidden-xs">&nbsp;</th>
<th>{{ trans('list.description') }}</th> <th>{{ trans('list.description') }}</th>
<th>{{ trans('list.amount') }}</th> <th>{{ trans('list.amount') }}</th>
{% if config('firefly.feature_flags.running_balance_column') %} {% if FireflyConfig.get('use_running_balance', config('firefly.feature_flags.running_balance_column')) %}
<th>{{ trans('list.running_balance') }}</th> <th>{{ trans('list.running_balance') }}</th>
{% endif %} {% endif %}
<th>{{ trans('list.date') }}</th> <th>{{ trans('list.date') }}</th>
@@ -266,7 +266,7 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
</td> </td>
{% if config('firefly.feature_flags.running_balance_column') %} {% if FireflyConfig.get('use_running_balance', config('firefly.feature_flags.running_balance_column')) %}
<td> <td>
{% if (null == transaction.balance_dirty or false == transaction.balance_dirty) and null != transaction.destination_balance_after and null != transaction.source_balance_after %} {% 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' %} {% if transaction.transaction_type_type == 'Deposit' %}

View File

@@ -119,11 +119,11 @@
</tr> </tr>
<tr> <tr>
<td>Exchange rates</td> <td>Exchange rates</td>
<td>{% if config('cer.enabled') %}Enabled{% else %}Disabled{% endif %}, downloads {% if config('cer.download_enabled') %}enabled{% else %}disabled{% endif %}</td> <td>{% 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 %}</td>
</tr> </tr>
<tr> <tr>
<td>RB-column</td> <td>RB-column</td>
<td>{% if config('firefly.feature_flags.running_balance_column') %}Enabled{% else %}Disabled{% endif %}</td> <td>{% if FireflyConfig.get('use_running_balance', config('firefly.feature_flags.running_balance_column')) %}Enabled{% else %}Disabled{% endif %}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@@ -226,7 +226,7 @@
<span>{{ 'currencies'|_ }}</span> <span>{{ 'currencies'|_ }}</span>
</a> </a>
</li> </li>
{% if config('cer.enabled') %} {% if FireflyConfig.get('enable_exchange_rates', config('cer.enabled')) %}
<li class="{{ activeRoutePartial('exchange-rates') }}"> <li class="{{ activeRoutePartial('exchange-rates') }}">
<a class="{{ activeRoutePartial('exchange-rates') }}" href="{{ route('exchange-rates.index') }}"> <a class="{{ activeRoutePartial('exchange-rates') }}" href="{{ route('exchange-rates.index') }}">
<span class="fa fa-angle-right fa-fw"></span> <span class="fa fa-angle-right fa-fw"></span>

View File

@@ -101,7 +101,7 @@
</div> </div>
{# conversion back to primary currency #} {# conversion back to primary currency #}
{% if config('cer.enabled') %} {% if FireflyConfig.get('enable_exchange_rates', config('cer.enabled')) %}
<div class="preferences-box"> <div class="preferences-box">
<h3>{{ 'pref_convert_to_primary'|_ }}</h3> <h3>{{ 'pref_convert_to_primary'|_ }}</h3>
<p class="text-info"> <p class="text-info">