service credentials
This commit is contained in:
@@ -27,8 +27,10 @@ class CreateService
|
||||
'status' => ServiceStatus::NOT_INSTALLED,
|
||||
]);
|
||||
|
||||
$service->credentials = $service->driver()->defaultCredentials();
|
||||
$service->save();
|
||||
if (method_exists($service->driver(), 'defaultCredentials')) {
|
||||
$service->credentials = $service->driver()->defaultCredentials();
|
||||
$service->save();
|
||||
}
|
||||
|
||||
dispatch(new DeployService($service));
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ class Caddy2Driver extends GatewayDriver
|
||||
$script->push('cd services');
|
||||
$script->push("test -d {$this->service->id} || mkdir {$this->service->id}");
|
||||
$script->push("cd {$this->service->id}");
|
||||
return $script->join("\n");
|
||||
}
|
||||
),
|
||||
new Step(
|
||||
@@ -49,7 +50,9 @@ class Caddy2Driver extends GatewayDriver
|
||||
}
|
||||
$runCommand .= ' -p 80:80 -p 443:443 caddy:2';
|
||||
|
||||
return $runCommand;
|
||||
$script->push($runCommand);
|
||||
|
||||
return $script->join("\n");
|
||||
}
|
||||
),
|
||||
]);
|
||||
|
||||
@@ -18,6 +18,6 @@ abstract class Driver
|
||||
abstract public function __construct(
|
||||
?string $containerName = null,
|
||||
?string $containerId = null,
|
||||
?int $service = null,
|
||||
?Service $service = null,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,4 +15,4 @@ abstract class GatewayDriver extends Driver
|
||||
?string $containerId = null,
|
||||
?Service $service = null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Drivers\DatabaseDriver;
|
||||
use App\Drivers\Driver;
|
||||
use App\Enums\ServiceCategory;
|
||||
use App\Enums\ServiceStatus;
|
||||
@@ -57,11 +58,16 @@ class Service extends Model
|
||||
throw new \Exception("Driver class {$class} not found");
|
||||
}
|
||||
|
||||
return new $class(
|
||||
$driver = new $class(
|
||||
containerName: $this->container_name,
|
||||
containerId: $this->container_id,
|
||||
serviceId: $this->id,
|
||||
credentials: $this->credentials
|
||||
service: $this,
|
||||
);
|
||||
|
||||
if ($driver instanceof DatabaseDriver) {
|
||||
$driver->credentials = $this->credentials;
|
||||
}
|
||||
|
||||
return $driver;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user