feat: refs #8847 If unhautorized no exit processs

This commit is contained in:
Guillermo Bonet 2025-04-17 09:38:40 +02:00
parent 71975cf941
commit 31a474b3e3
3 changed files with 11 additions and 4 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
node_modules
.grafana-find.*.json

12
main.js
View File

@ -49,7 +49,11 @@ const configPaths = [
];
for (const configPath of configPaths) {
const configFile = `${configPath}/.grafana-find.json`;
if (fs.existsSync(configFile)) {
const configFileDev = `${configPath}/.grafana-find.dev.json`;
if (fs.existsSync(configFileDev)) {
config = require(configFileDev);
break;
} else if (fs.existsSync(configFile)) {
config = require(configFile);
break;
}
@ -155,6 +159,7 @@ async function main(){
console.log(colors.red.bold(`🏢 Organization: ${AllOrganizations[x].name} 🏢\n`.underline));
response = await fetch(`${urlDashboards}${AllOrganizations[x].id}`, {
method: "GET",
redirect: 'manual',
headers: {
Authorization: credentials
},
@ -173,10 +178,11 @@ async function main(){
let allUID = await response.json();
if (allUID.message === 'Unauthorized') {
console.log(colors.red.bold(allUID.message))
process.exit();
console.log(colors.red.bold(`${allUID.message}\n`));
continue;
}
for (let i in allUID) {
let url = `${urlUID}${allUID[i].uid}`;
response = await fetch(url, {

View File

@ -1,6 +1,6 @@
{
"name": "grafana-find",
"version": "1.0.5",
"version": "1.0.6",
"author": "Verdnatura Levante SL",
"description": "Grafana Find Tool",
"license": "GPL-3.0",