mirror of
https://github.com/imputnet/cobalt.git
synced 2025-12-10 20:02:50 +00:00
api/api-keys: replace .find() with .some() in allowedServices
& also a little refactor
This commit is contained in:
parent
dce9eb30c1
commit
8feaf5c636
@ -80,10 +80,10 @@ const validateKeys = (input) => {
|
||||
}
|
||||
|
||||
if (details.allowedServices) {
|
||||
const isArray = Array.isArray(details.allowedServices);
|
||||
|
||||
if (isArray) {
|
||||
const invalid_services = details.allowedServices.find(service => !env.allServices.has(service));
|
||||
if (Array.isArray(details.allowedServices)) {
|
||||
const invalid_services = details.allowedServices.some(
|
||||
service => !env.allServices.has(service)
|
||||
);
|
||||
if (invalid_services) {
|
||||
throw "`allowedServices` in details contains an invalid service";
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user