internal ip base config
This commit is contained in:
@@ -30,7 +30,6 @@ class Server extends Model
|
|||||||
parent::boot();
|
parent::boot();
|
||||||
|
|
||||||
static::creating(function (self $server) {
|
static::creating(function (self $server) {
|
||||||
// $server->internal_ip_ending = random_int(2, 254);
|
|
||||||
$existingServer = Server::whereOrganisationId($server->organisation_id)
|
$existingServer = Server::whereOrganisationId($server->organisation_id)
|
||||||
->orderByDesc('internal_ip_ending')
|
->orderByDesc('internal_ip_ending')
|
||||||
->first();
|
->first();
|
||||||
@@ -38,6 +37,7 @@ class Server extends Model
|
|||||||
$server->internal_ip_ending = $existingServer
|
$server->internal_ip_ending = $existingServer
|
||||||
? $existingServer->internal_ip_ending + 1
|
? $existingServer->internal_ip_ending + 1
|
||||||
: 2;
|
: 2;
|
||||||
|
$server->internal_ip = config('keystone.internal_ip_base') . $server->internal_ip_ending;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,5 +7,6 @@ return [
|
|||||||
'postgres' => [
|
'postgres' => [
|
||||||
'17' => Postgres17Driver::class,
|
'17' => Postgres17Driver::class,
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
|
'internal_ip_base' => env('INTERNAL_IP_BASE', '192.168.2.'),
|
||||||
];
|
];
|
||||||
Reference in New Issue
Block a user