fix(voice-call): check env vars before validation errors
The validateProviderConfig() function was reporting missing credentials even when environment variables were set, because validation ran before the env var fallback in runtime.ts was reached. Now checks process.env.* as fallback for all provider credentials: - Twilio: TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN - Telnyx: TELNYX_API_KEY, TELNYX_CONNECTION_ID - Plivo: PLIVO_AUTH_ID, PLIVO_AUTH_TOKEN Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
6859e1e6a6
commit
dd834b8992
@ -403,12 +403,12 @@ export function validateProviderConfig(config: VoiceCallConfig): {
|
||||
}
|
||||
|
||||
if (config.provider === "telnyx") {
|
||||
if (!config.telnyx?.apiKey) {
|
||||
if (!config.telnyx?.apiKey && !process.env.TELNYX_API_KEY) {
|
||||
errors.push(
|
||||
"plugins.entries.voice-call.config.telnyx.apiKey is required (or set TELNYX_API_KEY env)",
|
||||
);
|
||||
}
|
||||
if (!config.telnyx?.connectionId) {
|
||||
if (!config.telnyx?.connectionId && !process.env.TELNYX_CONNECTION_ID) {
|
||||
errors.push(
|
||||
"plugins.entries.voice-call.config.telnyx.connectionId is required (or set TELNYX_CONNECTION_ID env)",
|
||||
);
|
||||
@ -416,12 +416,12 @@ export function validateProviderConfig(config: VoiceCallConfig): {
|
||||
}
|
||||
|
||||
if (config.provider === "twilio") {
|
||||
if (!config.twilio?.accountSid) {
|
||||
if (!config.twilio?.accountSid && !process.env.TWILIO_ACCOUNT_SID) {
|
||||
errors.push(
|
||||
"plugins.entries.voice-call.config.twilio.accountSid is required (or set TWILIO_ACCOUNT_SID env)",
|
||||
);
|
||||
}
|
||||
if (!config.twilio?.authToken) {
|
||||
if (!config.twilio?.authToken && !process.env.TWILIO_AUTH_TOKEN) {
|
||||
errors.push(
|
||||
"plugins.entries.voice-call.config.twilio.authToken is required (or set TWILIO_AUTH_TOKEN env)",
|
||||
);
|
||||
@ -429,12 +429,12 @@ export function validateProviderConfig(config: VoiceCallConfig): {
|
||||
}
|
||||
|
||||
if (config.provider === "plivo") {
|
||||
if (!config.plivo?.authId) {
|
||||
if (!config.plivo?.authId && !process.env.PLIVO_AUTH_ID) {
|
||||
errors.push(
|
||||
"plugins.entries.voice-call.config.plivo.authId is required (or set PLIVO_AUTH_ID env)",
|
||||
);
|
||||
}
|
||||
if (!config.plivo?.authToken) {
|
||||
if (!config.plivo?.authToken && !process.env.PLIVO_AUTH_TOKEN) {
|
||||
errors.push(
|
||||
"plugins.entries.voice-call.config.plivo.authToken is required (or set PLIVO_AUTH_TOKEN env)",
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user