Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function clientFromKey(key: string) {
let client = clients.get(key)
if (!client) {
const conf = await readConfiguration(key)
if (conf) {
const sslconf = conf.url.match(/https:/i)
? createSSLConfig(conf.allowSelfSigned, conf.customCA)
: {}
sslconf.debugCallback = debugCallBack(conf)
client = new ADTClient(
conf.url,
conf.username,
conf.password,
conf.client,
conf.language,
sslconf
)
const traceUrl = clientTraceUrl(conf)
if (traceUrl) client = loggedProxy(client, conf)
clients.set(key, client)
}
}
return client
export function createClient(conf: RemoteConfig) {
const sslconf = conf.url.match(/https:/i)
? createSSLConfig(conf.allowSelfSigned, conf.customCA)
: {}
sslconf.debugCallback = httpLogger(conf)
const client = new ADTClient(
conf.url,
conf.username,
conf.password,
conf.client,
conf.language,
sslconf
)
return loggedProxy(client, conf)
}