Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function create() {
const ip = process.env.AD_IP || 'localhost';
const user = process.env.AD_USER || 'developer';
const pass = process.env.AD_PASS || 'Down1oad';
return new ADTClient(
`http://${ip}:8000`,
user,
pass,
);
}
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)
}
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
}