Allocation limit added
This commit is contained in:
parent
6499941166
commit
6a431edd8b
3 changed files with 14 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Classes;
|
||||
|
||||
use App\Models\Configuration;
|
||||
use App\Models\Egg;
|
||||
use App\Models\Nest;
|
||||
use App\Models\Node;
|
||||
|
@ -124,7 +125,8 @@ class Pterodactyl
|
|||
*/
|
||||
public static function getAllocations(Node $node)
|
||||
{
|
||||
$response = self::client()->get("/application/nodes/{$node->id}/allocations");
|
||||
$per_page = Configuration::getValueByKey('ALLOCATION_LIMIT' , 200);
|
||||
$response = self::client()->get("/application/nodes/{$node->id}/allocations?per_page={$per_page}");
|
||||
if ($response->failed()) throw self::getException();
|
||||
return $response->json();
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\UsefulLink;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
|
|
@ -109,5 +109,16 @@ class ConfigurationSeeder extends Seeder
|
|||
'type' => 'boolean',
|
||||
'description' => 'Prevent users from making multiple accounts using the same IP address'
|
||||
]);
|
||||
|
||||
//per_page on allocations request
|
||||
Configuration::firstOrCreate([
|
||||
'key' => 'ALLOCATION_LIMIT',
|
||||
], [
|
||||
'value' => '200',
|
||||
'type' => 'integer',
|
||||
'description' => 'The maximum amount of allocations to pull per node for automatic deployment, if more allocations are being used than this limit is set to, no new servers can be created!'
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue