Add gitignore and fixes
This commit is contained in:
parent
0c4a47ee95
commit
46995c0bb2
|
@ -0,0 +1 @@
|
||||||
|
node_modules
|
14
main.js
14
main.js
|
@ -134,13 +134,17 @@ async function main(){
|
||||||
|
|
||||||
const credentials = `Basic ` + Buffer.from(`${user}:${passw}`).toString('base64');
|
const credentials = `Basic ` + Buffer.from(`${user}:${passw}`).toString('base64');
|
||||||
|
|
||||||
let response = await fetch(urlOrganizations, {
|
try {
|
||||||
|
var response = await fetch(urlOrganizations, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: credentials
|
Authorization: credentials
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} catch (notfound) {
|
||||||
|
console.error(`${error}Server '${config.grafanaUrl}' not found`.red);
|
||||||
|
process.exit(1);
|
||||||
|
};
|
||||||
let AllOrganizations = await response.json();
|
let AllOrganizations = await response.json();
|
||||||
|
|
||||||
if (AllOrganizations.message==='invalid username or password') {
|
if (AllOrganizations.message==='invalid username or password') {
|
||||||
|
@ -262,6 +266,12 @@ async function main(){
|
||||||
|
|
||||||
console.log(colors.green.bold(`-------- Have been found ${numberOfObjects} results in ${totalDashboards} dashboards -------\n`));
|
console.log(colors.green.bold(`-------- Have been found ${numberOfObjects} results in ${totalDashboards} dashboards -------\n`));
|
||||||
|
|
||||||
|
if (!response) {
|
||||||
|
console.log(`${error}The server don't exists`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
process.exit();
|
process.exit();
|
||||||
|
|
||||||
}
|
}
|
||||||
main();
|
main();
|
Loading…
Reference in New Issue