feat: cli tenant support

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-02-19 00:18:32 -05:00
parent cdbf01111f
commit decda8becc
2 changed files with 25 additions and 0 deletions

View File

@@ -16,4 +16,9 @@ class TenantService
return $this->store->fetchByDomain($domain); return $this->store->fetchByDomain($domain);
} }
public function fetchById(string $identifier): ?TenantObject
{
return $this->store->fetch($identifier);
}
} }

View File

@@ -37,6 +37,26 @@ class SessionTenant
} }
} }
/**
* Configure the tenant by its identifier (for console / CLI usage).
*/
public function configureById(string $identifier): void
{
if ($this->configured) {
return;
}
$tenant = $this->tenantService->fetchById($identifier);
if ($tenant) {
$this->domain = $identifier;
$this->tenant = $tenant;
$this->configured = true;
} else {
$this->domain = null;
$this->tenant = null;
$this->configured = false;
}
}
/** /**
* Is the tenant configured * Is the tenant configured
*/ */