2021-01-23 20:09:16 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
|
|
use Ramsey\Uuid\Uuid;
|
|
|
|
use Illuminate\Support\Str;
|
|
|
|
use Pterodactyl\Models\Node;
|
|
|
|
use Illuminate\Support\Facades\Crypt;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
|
|
|
class NodeFactory extends Factory
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name of the factory's corresponding model.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $model = Node::class;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the model's default state.
|
|
|
|
*/
|
|
|
|
public function definition(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'uuid' => Uuid::uuid4()->toString(),
|
|
|
|
'public' => true,
|
2022-06-27 01:00:19 +00:00
|
|
|
'name' => 'FactoryNode_' . Str::random(10),
|
2021-07-11 17:27:15 +00:00
|
|
|
'fqdn' => $this->faker->unique()->ipv4,
|
2022-12-15 01:23:46 +00:00
|
|
|
'listen_port_http' => 8080,
|
|
|
|
'listen_port_sftp' => 2022,
|
|
|
|
'public_port_http' => 8080,
|
|
|
|
'public_port_sftp' => 2022,
|
2021-01-23 20:09:16 +00:00
|
|
|
'scheme' => 'http',
|
|
|
|
'behind_proxy' => false,
|
|
|
|
'memory' => 1024,
|
|
|
|
'memory_overallocate' => 0,
|
|
|
|
'disk' => 10240,
|
|
|
|
'disk_overallocate' => 0,
|
|
|
|
'upload_size' => 100,
|
|
|
|
'daemon_token_id' => Str::random(Node::DAEMON_TOKEN_ID_LENGTH),
|
|
|
|
'daemon_token' => Crypt::encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)),
|
2022-12-15 01:23:46 +00:00
|
|
|
'daemon_base' => Node::DEFAULT_DAEMON_BASE,
|
2021-01-23 20:09:16 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|