Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const setupUserRest = async(user) => {
const setupAPI = new SetupAPI(new InfluxDB(__config.influx_url));
setupAPI.getSetup().then(async ({allowed}) => {
let body = {org: user.org, bucket: user.bucket, username: user.username, password: user.password };
if(user.token){
body.token = user.token;
}
if(allowed){
await setupAPI.postSetup({
body: body,
});
console.log(`--- Setup user ${user.username} at ${__config.influx_url} success ---`)
}else{
console.error(`--- Failed to setup user ${user.username} at ${__config.influx_url} ---`);