Add gitignore and fixes
This commit is contained in:
parent
0c4a47ee95
commit
46995c0bb2
|
@ -0,0 +1 @@
|
|||
node_modules
|
24
main.js
24
main.js
|
@ -134,13 +134,17 @@ async function main(){
|
|||
|
||||
const credentials = `Basic ` + Buffer.from(`${user}:${passw}`).toString('base64');
|
||||
|
||||
let response = await fetch(urlOrganizations, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: credentials
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
var response = await fetch(urlOrganizations, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: credentials
|
||||
}
|
||||
});
|
||||
} catch (notfound) {
|
||||
console.error(`${error}Server '${config.grafanaUrl}' not found`.red);
|
||||
process.exit(1);
|
||||
};
|
||||
let AllOrganizations = await response.json();
|
||||
|
||||
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`));
|
||||
|
||||
if (!response) {
|
||||
console.log(`${error}The server don't exists`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
process.exit();
|
||||
|
||||
}
|
||||
main();
|
Loading…
Reference in New Issue