feat(sms): simplify SMS settings to use only KAVENEGAR_API_KEY from env, remove other SMS-related fields from config
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Sms\Provider;
|
||||
|
||||
use App\Config\Repository\SiteConfigRepository;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
@@ -12,16 +11,14 @@ class KavehNegarProvider implements SmsProviderInterface
|
||||
|
||||
public function __construct(
|
||||
private readonly HttpClientInterface $httpClient,
|
||||
private readonly SiteConfigRepository $configRepo,
|
||||
private readonly LoggerInterface $logger,
|
||||
// Nullable: env `%env(default::KAVENEGAR_API_KEY)%` resolves to null when unset
|
||||
// (the real key normally comes from DB site config below, not env).
|
||||
// API key comes only from env `%env(default::KAVENEGAR_API_KEY)%`; null when unset.
|
||||
private readonly ?string $apiKey = null,
|
||||
private readonly ?string $sender = null,
|
||||
) {}
|
||||
|
||||
private function key(): string { return $this->configRepo->get('kavenegar_api_key') ?: ($this->apiKey ?? ''); }
|
||||
private function sender(): string { return $this->configRepo->get('kavenegar_sender') ?: ($this->sender ?? ''); }
|
||||
private function key(): string { return $this->apiKey ?? ''; }
|
||||
private function sender(): string { return $this->sender ?? ''; }
|
||||
|
||||
public function getName(): string { return 'kavenegar'; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user