feat: refs #8847 If unhautorized no exit processs
This commit is contained in:
parent
71975cf941
commit
31a474b3e3
|
@ -1 +1,2 @@
|
||||||
node_modules
|
node_modules
|
||||||
|
.grafana-find.*.json
|
12
main.js
12
main.js
|
@ -49,7 +49,11 @@ const configPaths = [
|
||||||
];
|
];
|
||||||
for (const configPath of configPaths) {
|
for (const configPath of configPaths) {
|
||||||
const configFile = `${configPath}/.grafana-find.json`;
|
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);
|
config = require(configFile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -155,6 +159,7 @@ async function main(){
|
||||||
console.log(colors.red.bold(`🏢 Organization: ${AllOrganizations[x].name} 🏢\n`.underline));
|
console.log(colors.red.bold(`🏢 Organization: ${AllOrganizations[x].name} 🏢\n`.underline));
|
||||||
response = await fetch(`${urlDashboards}${AllOrganizations[x].id}`, {
|
response = await fetch(`${urlDashboards}${AllOrganizations[x].id}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
redirect: 'manual',
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: credentials
|
Authorization: credentials
|
||||||
},
|
},
|
||||||
|
@ -173,10 +178,11 @@ async function main(){
|
||||||
let allUID = await response.json();
|
let allUID = await response.json();
|
||||||
|
|
||||||
if (allUID.message === 'Unauthorized') {
|
if (allUID.message === 'Unauthorized') {
|
||||||
console.log(colors.red.bold(allUID.message))
|
console.log(colors.red.bold(`${allUID.message}\n`));
|
||||||
process.exit();
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (let i in allUID) {
|
for (let i in allUID) {
|
||||||
let url = `${urlUID}${allUID[i].uid}`;
|
let url = `${urlUID}${allUID[i].uid}`;
|
||||||
response = await fetch(url, {
|
response = await fetch(url, {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "grafana-find",
|
"name": "grafana-find",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "Grafana Find Tool",
|
"description": "Grafana Find Tool",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
Loading…
Reference in New Issue