Added warning when bot apis and serviceaccounts exist.
This commit is contained in:
@@ -34,6 +34,11 @@ function validateConfig(config) {
|
|||||||
const hasSvcAccounts = Array.isArray(config.serviceAccounts) && config.serviceAccounts.length > 0;
|
const hasSvcAccounts = Array.isArray(config.serviceAccounts) && config.serviceAccounts.length > 0;
|
||||||
const hasCredPath = !!config.credentialsPath;
|
const hasCredPath = !!config.credentialsPath;
|
||||||
|
|
||||||
|
// Do not allow both API keys and service accounts to be present simultaneously
|
||||||
|
if (hasApiKeys && hasSvcAccounts) {
|
||||||
|
throw new Error('Configuration must not include both `apiKeys` and `serviceAccounts`; choose one authentication method');
|
||||||
|
}
|
||||||
|
|
||||||
if (!hasApiKeys && !hasSvcAccounts && !hasCredPath) {
|
if (!hasApiKeys && !hasSvcAccounts && !hasCredPath) {
|
||||||
throw new Error('Configuration must include at least one of: `apiKeys`, `serviceAccounts`, or `credentialsPath`');
|
throw new Error('Configuration must include at least one of: `apiKeys`, `serviceAccounts`, or `credentialsPath`');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user