Skip to content

Commit aa0a4c2

Browse files
committed
fix mapping scroll-monitor:GRAFANA_HOST[C
1 parent d6be20e commit aa0a4c2

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

src/commands/setup/prep-charts.ts

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ export default class SetupPrepCharts extends Command {
198198
'l1-devnet': 'L1_DEVNET_HOST',
199199
'blockscout': 'BLOCKSCOUT_HOST',
200200
'admin-system-dashboard': 'ADMIN_SYSTEM_DASHBOARD_HOST',
201-
'grafana': 'GRAFANA_HOST',
202201
};
203202

204203
const alternativeKey = alternativeMappings[chartName];
@@ -238,6 +237,46 @@ export default class SetupPrepCharts extends Command {
238237
}
239238
}
240239

240+
if (productionYaml.grafana) {
241+
let ingressUpdated = false;
242+
let ingressValue = productionYaml.grafana.ingress;
243+
if (ingressValue && typeof ingressValue === 'object' && 'hosts' in ingressValue) {
244+
const hosts = ingressValue.hosts as Array<string>;
245+
if (Array.isArray(hosts)) {
246+
for (let i = 0; i < hosts.length; i++) {
247+
if (typeof (hosts[i]) === 'string') {
248+
let configValue: string | undefined;
249+
configValue = this.getConfigValue("ingress.GRAFANA_HOST");
250+
251+
if (configValue && (configValue !== hosts[i])) {
252+
changes.push({ key: `ingress.hosts[${i}]`, oldValue: hosts[i], newValue: configValue });
253+
hosts[i] = configValue;
254+
ingressUpdated = true;
255+
}
256+
}
257+
}
258+
}
259+
}
260+
261+
if (ingressUpdated) {
262+
updated = true;
263+
// Update the tls section if it exists
264+
for (const [ingressKey, ingressValue] of Object.entries(productionYaml.grafana.ingress)) {
265+
if (ingressValue && typeof ingressValue === 'object' && 'tls' in ingressValue && 'hosts' in ingressValue) {
266+
const tlsEntries = ingressValue.tls as Array<{ hosts: string[] }>;
267+
const hosts = ingressValue.hosts as Array<{ host: string }>;
268+
if (Array.isArray(tlsEntries) && Array.isArray(hosts)) {
269+
tlsEntries.forEach((tlsEntry) => {
270+
if (Array.isArray(tlsEntry.hosts)) {
271+
tlsEntry.hosts = hosts.map((host) => host.host);
272+
}
273+
});
274+
}
275+
}
276+
}
277+
}
278+
}
279+
241280
if (updated) {
242281
this.log(`\nFor ${chalk.cyan(file)}:`)
243282
this.log(chalk.green('Changes:'))

0 commit comments

Comments
 (0)