root password comes from hetzner, not me
This commit is contained in:
@@ -56,7 +56,6 @@ class ServerController extends Controller
|
|||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$rootPassword = Str::random(32);
|
|
||||||
$sudoPassword = Str::random(32);
|
$sudoPassword = Str::random(32);
|
||||||
$providerService = app(GetProviderService::class)->execute($request->provider);
|
$providerService = app(GetProviderService::class)->execute($request->provider);
|
||||||
|
|
||||||
@@ -69,7 +68,6 @@ class ServerController extends Controller
|
|||||||
serverType: $request->server_type,
|
serverType: $request->server_type,
|
||||||
location: $request->location,
|
location: $request->location,
|
||||||
image: $request->image,
|
image: $request->image,
|
||||||
rootPassword: $rootPassword,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$organisation = Organisation::findOrFail($request->route('organisation'));
|
$organisation = Organisation::findOrFail($request->route('organisation'));
|
||||||
@@ -90,7 +88,7 @@ class ServerController extends Controller
|
|||||||
|
|
||||||
dispatch(new WaitForServerToConnect(
|
dispatch(new WaitForServerToConnect(
|
||||||
server: $server,
|
server: $server,
|
||||||
rootPassword: $rootPassword,
|
rootPassword: $createdServer->rootPassword,
|
||||||
sudoPassword: $sudoPassword,
|
sudoPassword: $sudoPassword,
|
||||||
))->delay(now()->addSeconds(30));
|
))->delay(now()->addSeconds(30));
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ class CreateServerRequest extends Request implements HasBody
|
|||||||
protected ?string $name = null,
|
protected ?string $name = null,
|
||||||
protected ?string $serverType = null,
|
protected ?string $serverType = null,
|
||||||
protected ?string $location = null,
|
protected ?string $location = null,
|
||||||
protected ?string $rootPassword = null,
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
protected function defaultBody(): array
|
protected function defaultBody(): array
|
||||||
@@ -28,7 +27,6 @@ class CreateServerRequest extends Request implements HasBody
|
|||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'server_type' => $this->serverType,
|
'server_type' => $this->serverType,
|
||||||
'location' => $this->location,
|
'location' => $this->location,
|
||||||
'root_password' => $this->rootPassword,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,14 +26,12 @@ class HetznerService extends ServerProviderService
|
|||||||
string $serverType,
|
string $serverType,
|
||||||
string $location,
|
string $location,
|
||||||
string $image,
|
string $image,
|
||||||
string $rootPassword,
|
|
||||||
): CreatedServer {
|
): CreatedServer {
|
||||||
$response = $this->connector->send(new CreateServerRequest(
|
$response = $this->connector->send(new CreateServerRequest(
|
||||||
image: $image,
|
image: $image,
|
||||||
name: $name,
|
name: $name,
|
||||||
serverType: $serverType,
|
serverType: $serverType,
|
||||||
location: $location,
|
location: $location,
|
||||||
rootPassword: $rootPassword,
|
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($response->status() !== 201) {
|
if ($response->status() !== 201) {
|
||||||
@@ -43,7 +41,7 @@ class HetznerService extends ServerProviderService
|
|||||||
return new CreatedServer(
|
return new CreatedServer(
|
||||||
id: $response->json('server.id'),
|
id: $response->json('server.id'),
|
||||||
name: $name,
|
name: $name,
|
||||||
rootPassword: $rootPassword,
|
rootPassword: $response->json('root_password'),
|
||||||
status: $response->json('server.status'),
|
status: $response->json('server.status'),
|
||||||
ipv4: $response->json('server.public_net.ipv4.ip'),
|
ipv4: $response->json('server.public_net.ipv4.ip'),
|
||||||
ipv6: $response->json('server.public_net.ipv6.ip'),
|
ipv6: $response->json('server.public_net.ipv6.ip'),
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ abstract class ServerProviderService
|
|||||||
string $serverType,
|
string $serverType,
|
||||||
string $location,
|
string $location,
|
||||||
string $image,
|
string $image,
|
||||||
string $rootPassword,
|
|
||||||
): CreatedServer;
|
): CreatedServer;
|
||||||
|
|
||||||
abstract public function getServerTypes(): Collection;
|
abstract public function getServerTypes(): Collection;
|
||||||
|
|||||||
Reference in New Issue
Block a user