Skip to content

Commit 903b6b5

Browse files
author
Owen Conti
committed
Update commands to use arguments instead of .env
1 parent a96fada commit 903b6b5

4 files changed

Lines changed: 19 additions & 21 deletions

File tree

app/Commands/DeleteSite.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,19 @@ class DeleteSite extends Command
1212
use UseForgeSdk;
1313

1414
protected $signature = 'app:delete-site
15+
{forge-cli-token : The Forge CLI token to use}
16+
{forge-server-id : The Forge server ID to use}
17+
{root-domain : The root domain to use (example.com)}
1518
{branch : The name of the branch to delete.}';
1619

1720
protected $description = 'Deletes the site on the server, including the database.';
1821

22+
protected string $domain;
23+
1924
public function handle(): void
2025
{
2126
$this->buildForge();
22-
$domain = $this->argument('branch') . '.' . config('forge.root_domain');
27+
$this->domain = $this->argument('branch') . '.' . $this->argument('root-domain');
2328

2429
try {
2530
$this->deleteSite();
@@ -40,8 +45,7 @@ protected function getDatabase(): Database
4045

4146
protected function deleteSite(): void
4247
{
43-
$domain = $this->argument('branch') . '.' . config('forge.root_domain');
44-
$site = $this->getSite($domain);
48+
$site = $this->getSite($this->domain);
4549

4650
$this->output->info('Deleting site...');
4751
$this->forge->deleteSite($this->forgeServerId, $site->id);

app/Commands/DeploySite.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
class DeploySite extends Command
1111
{
1212
protected $signature = 'app:deploy-site
13+
{forge-cli-token : The Forge CLI token to use}
14+
{forge-server-id : The Forge server ID to use}
15+
{root-domain : The root domain to use (example.com)}
16+
{git-provider : The git provider to use (github, gitlab)}
17+
{repository : The repository to use (username/repository)}
1318
{branch : The name of the branch to deploy (will be used for the subdomain and database name)}
1419
{php-version : The PHP version to use (php82, php81, php80, php74)}
1520
{env : Base64 encoded .env file to use for the site}';
@@ -24,7 +29,7 @@ class DeploySite extends Command
2429
public function handle(): void
2530
{
2631
$this->buildForge();
27-
$this->domain = $this->argument('branch') . '.' . config('forge.root_domain');
32+
$this->domain = $this->argument('branch') . '.' . $this->argument('root-domain');
2833

2934
try {
3035
$site = $this->getSite();
@@ -63,8 +68,8 @@ protected function createSite(): Site
6368

6469
$this->output->info('Site created, installing git repository...');
6570
$this->forge->installGitRepositoryOnSite($this->forgeServerId, $site->id, [
66-
'provider' => config('forge.git_provider'),
67-
'repository' => config('forge.repository'),
71+
'provider' => $this->argument('git-provider'),
72+
'repository' => $this->argument('repository'),
6873
'branch' => $this->argument('branch'),
6974
'composer' => true
7075
]);
@@ -87,8 +92,8 @@ protected function deploySite(Site $site): void
8792

8893
protected function buildForge(): void
8994
{
90-
$this->forgeApiToken = config('forge.token');
91-
$this->forgeServerId = config('forge.server_id');
95+
$this->forgeApiToken = $this->argument('forge-cli-token');
96+
$this->forgeServerId = $this->argument('forge-server-id');
9297

9398
if (empty($this->forgeApiToken)) {
9499
$this->forgeApiToken = $this->ask('What is your Forge API token?');

app/Traits/UseForgeSdk.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ protected function getSite(string $domain): ?Site
2323

2424
protected function buildForge(): void
2525
{
26-
$this->forgeApiToken = config('forge.token');
27-
$this->forgeServerId = config('forge.server_id');
26+
$this->forgeApiToken = $this->argument('forge-cli-token');
27+
$this->forgeServerId = $this->argument('forge-server-id');
2828

2929
if (empty($this->forgeApiToken)) {
3030
$this->forgeApiToken = $this->ask('What is your Forge API token?');

config/forge.php

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)