feat(vikon): move API token from .env to integration_credentials
- Rename VICON_TOKEN → VIKON_API_TOKEN in .env and config - Add ViconApiToken service reading from integration_credentials table - Update 3 Vicon services to use ViconApiToken instead of config() - Config/env kept as fallback for clean migration
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Vicon;
|
||||
|
||||
use App\Containers\Dashboard\Tasks\IntegrationCredentials\GetIntegrationCredentialTask;
|
||||
|
||||
class ViconApiToken
|
||||
{
|
||||
public function __construct(
|
||||
private readonly GetIntegrationCredentialTask $getCredential,
|
||||
) {}
|
||||
|
||||
public function get(): string
|
||||
{
|
||||
$credential = $this->getCredential->run('vikon_api');
|
||||
|
||||
if (!$credential || empty($credential->payload['token'])) {
|
||||
throw new \RuntimeException('VIKON API token not configured. Add it in /dashboard/integration-credentials.');
|
||||
}
|
||||
|
||||
return $credential->payload['token'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user