basic login
This commit is contained in:
parent
8a9dc64917
commit
2e9b91c2fe
17
main.js
17
main.js
|
@ -15,7 +15,6 @@ if (!fs.existsSync(configFile)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const findAll = `Client`;
|
const findAll = `Client`;
|
||||||
const apiKey = `Bearer eyJrIjoickI3WVBab0lscldRdk9JV29YYUFKMEdqUDl6UmsyaHIiLCJuIjoiZ3JhZmFuYS1maW5kIiwiaWQiOjF9`;
|
|
||||||
|
|
||||||
const config = require(configFile);
|
const config = require(configFile);
|
||||||
const grafanaUrl = config.grafanaUrl;
|
const grafanaUrl = config.grafanaUrl;
|
||||||
|
@ -32,13 +31,16 @@ let nameVariables = new Array;
|
||||||
|
|
||||||
const regexRawSQL = new RegExp(findAll, 'i');
|
const regexRawSQL = new RegExp(findAll, 'i');
|
||||||
|
|
||||||
|
const user = `guillermo`;
|
||||||
|
|
||||||
async function main(){
|
async function main(){
|
||||||
|
|
||||||
const readline = require('readline');
|
const readline = require('readline');
|
||||||
const rl = readline.createInterface({
|
const rl = readline.createInterface({
|
||||||
input: process.stdin,
|
input: process.stdin,
|
||||||
output: process.stdout
|
output: process.stdout
|
||||||
});/*
|
});
|
||||||
|
|
||||||
const answer = await new Promise(resolve => {
|
const answer = await new Promise(resolve => {
|
||||||
rl.question(colors.yellow('Enter your password: '), resolve);
|
rl.question(colors.yellow('Enter your password: '), resolve);
|
||||||
});
|
});
|
||||||
|
@ -46,17 +48,22 @@ async function main(){
|
||||||
console.error(`You need to put a password`.red);
|
console.error(`You need to put a password`.red);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
const passw = `${answer}`;
|
||||||
|
|
||||||
|
const credentials = `Basic ` + Buffer.from(`${user}:${passw}`).toString('base64');
|
||||||
rl.close();
|
rl.close();
|
||||||
*/
|
|
||||||
console.clear();
|
console.clear();
|
||||||
console.log(colors.green.bold(`-------------------- Starting process --------------------`));
|
console.log(colors.green.bold(`-------------------- Starting process --------------------`));
|
||||||
|
|
||||||
let responseAllUID = await fetch(urlDashboards, {
|
let responseAllUID = await fetch(urlDashboards, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": apiKey,
|
"Authorization": credentials,
|
||||||
|
"Content-Type" : "application/json"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let allUID = await responseAllUID.json();
|
let allUID = await responseAllUID.json();
|
||||||
|
|
||||||
for (let i=0; i < allUID.length; i++) {
|
for (let i=0; i < allUID.length; i++) {
|
||||||
|
@ -65,7 +72,7 @@ async function main(){
|
||||||
let response = await fetch(url, {
|
let response = await fetch(url, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": apiKey,
|
"Authorization": credentials,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let data = await response.json();
|
let data = await response.json();
|
||||||
|
|
Loading…
Reference in New Issue