Skip to content

Commit eda87f7

Browse files
committed
(simatec) Fix Grafana Backup & Restore
1 parent 5185a4d commit eda87f7

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ When you allow iobroker GmbH to collect diagnostic data, then also your installa
6363
## Changelog
6464
### **WORK IN PROGRESS**
6565
* (simatec) Translation updated
66+
* (simatec) Fix Grafana Backup & Restore
6667

6768
### 3.3.2 (2025-06-19)
6869
* (simatec) Base Topic for z2m Remote Backup added

lib/restore/grafana.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,16 @@ async function postData(options, log, tmpDir) {
5757
baseURL: `${protocol}://${host}:${port}`,
5858
url: '/api/datasources',
5959
data: dataSourceFile,
60-
headers: { 'Content-Type': 'application/json' },
60+
headers: {
61+
'Content-Type': 'application/json',
62+
Authorization: `Bearer ${apiKey}`
63+
},
64+
/*
6165
auth: {
6266
username: username,
6367
password: pass,
6468
},
69+
*/
6570
httpsAgent: new https.Agent({
6671
rejectUnauthorized: signedCertificates,
6772
}),
@@ -94,8 +99,7 @@ async function postData(options, log, tmpDir) {
9499
data: folderJson,
95100
headers: {
96101
'Content-Type': 'application/json',
97-
// eslint-disable-next-line quote-props
98-
'Authorization': `Bearer ${apiKey}`
102+
Authorization: `Bearer ${apiKey}`
99103
},
100104
httpsAgent: new https.Agent({
101105
rejectUnauthorized: signedCertificates,
@@ -135,8 +139,7 @@ async function postData(options, log, tmpDir) {
135139
baseURL: `${protocol}://${host}:${port}`,
136140
headers: {
137141
'Content-Type': 'application/json',
138-
// eslint-disable-next-line quote-props
139-
'Authorization': `Bearer ${apiKey}`
142+
Authorization: `Bearer ${apiKey}`
140143
},
141144
httpsAgent: new https.Agent({
142145
rejectUnauthorized: signedCertificates,

lib/scripts/36-grafana.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,13 @@ async function getData(options, log, dashboardDir, folderDir, datasourceDir, das
4242
const dataSourcesRequest = await axios({
4343
method: 'get',
4444
url: `${options.protocol}://${options.host}:${options.port}/api/datasources`,
45+
headers: { Authorization: `Bearer ${options.apiKey}` },
46+
/*
4547
auth: {
4648
username: options.username,
4749
password: options.pass,
4850
},
51+
*/
4952
responseType: 'json',
5053
httpsAgent: new https.Agent({
5154
rejectUnauthorized: options.signedCertificates,
@@ -67,8 +70,7 @@ async function getData(options, log, dashboardDir, folderDir, datasourceDir, das
6770
const dashBoardsRequest = await axios({
6871
method: 'get',
6972
url: `${options.protocol}://${options.host}:${options.port}/api/search`,
70-
// eslint-disable-next-line quote-props
71-
headers: { 'Authorization': `Bearer ${options.apiKey}` },
73+
headers: { Authorization: `Bearer ${options.apiKey}` },
7274
responseType: 'json',
7375
httpsAgent: new https.Agent({
7476
rejectUnauthorized: options.signedCertificates,
@@ -94,8 +96,7 @@ async function getData(options, log, dashboardDir, folderDir, datasourceDir, das
9496
dashBoardRequest = await axios({
9597
method: 'get',
9698
url: `${options.protocol}://${options.host}:${options.port}/api/dashboards/uid/${dashBoardData[0]}`,
97-
// eslint-disable-next-line quote-props
98-
headers: { 'Authorization': `Bearer ${options.apiKey}` },
99+
headers: { Authorization: `Bearer ${options.apiKey}` },
99100
responseType: 'json',
100101
httpsAgent: new https.Agent({
101102
rejectUnauthorized: options.signedCertificates
@@ -155,8 +156,7 @@ async function getData(options, log, dashboardDir, folderDir, datasourceDir, das
155156
const foldersRequest = await axios({
156157
method: 'get',
157158
url: `${options.protocol}://${options.host}:${options.port}/api/folders`,
158-
// eslint-disable-next-line quote-props
159-
headers: { 'Authorization': `Bearer ${options.apiKey}` },
159+
headers: { Authorization: `Bearer ${options.apiKey}` },
160160
responseType: 'json',
161161
httpsAgent: new https.Agent({
162162
rejectUnauthorized: options.signedCertificates,

0 commit comments

Comments
 (0)