Commit 2f37b154 authored by Ben Hayward's avatar Ben Hayward

added in config for max

1 merge request!251[Sprint/InterestingIguana](feat): Offchain boost rate limiting #475
Pipeline #72136978 canceled with stages
in 55 seconds
......@@ -298,9 +298,10 @@ class boost implements Interfaces\Api
}
if ($manager->boostLimitReached($boost)) {
$maxDaily = Di::_()->get('Config')->get('max_daily_boost_views');
return Factory::response([
'status' => 'error',
'message' => "This boost would exceeded the maximum of 10 offchain tokens per day."
'message' => "This boost would exceeded the maximum of ".$maxDaily." offchain tokens per day."
]);
}
......
......@@ -177,7 +177,9 @@ class Manager
$acc += $_boost->getImpressions();
return $acc;
});
return $acc + $boost->getImpressions() > 10000; //still allow 10k
$maxDaily = Di::_()->get('Config')->get('max_daily_boost_views');
return $acc + $boost->getImpressions() > $maxDaily; //still allow 10k
}
......
......@@ -275,6 +275,9 @@ $CONFIG->set('boost', [
],
]);
/* Maximum view per day */
$config->set('max_daily_boost_views', 10000);
$CONFIG->set('encryptionKeys', [
'email' => [
'private' => '{{email-private-key}}',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment