Make DNS servers fully dynamic from config.json
DNS server IDs (dns1, dns2, dns3) were hardcoded throughout the frontend and backend. Now config.json's dnsServers object is the single source of truth — adding or removing a DNS server in config automatically updates the dashboard cards, credential modal, health checks, and probes. - credentials.js: rebuild modal sections dynamically from SITE.dnsServers - globals.js: add getPrimaryDnsId() helper for primary DNS lookups - service-create.js, service-infrastructure.js: use dynamic DNS ID - startup-validator.js: dynamic topCardServices from config - middleware.js: add license endpoints to public routes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -293,6 +293,8 @@ module.exports = function configureMiddleware(app, {
|
||||
{ path: '/api/logo', exact: true, method: 'GET' },
|
||||
{ path: '/api/favicon', exact: true, method: 'GET' },
|
||||
{ path: '/api/themes', exact: true, method: 'GET' },
|
||||
{ path: '/api/license/status', exact: true, method: 'GET' },
|
||||
{ path: '/api/license/feature/', prefix: true, method: 'GET' },
|
||||
];
|
||||
|
||||
function isPublicRoute(req) {
|
||||
|
||||
@@ -162,14 +162,12 @@ async function validateStartupConfig({ log, CADDYFILE_PATH, SERVICES_FILE, CONFI
|
||||
async function syncHealthCheckerServices({ log, SERVICES_FILE, servicesStateManager, healthChecker, buildServiceUrl, siteConfig, APP }) {
|
||||
try {
|
||||
const topCardServices = [
|
||||
{ id: 'dns1', name: 'DNS1' },
|
||||
{ id: 'dns2', name: 'DNS2' },
|
||||
{ id: 'internet', name: 'Internet' },
|
||||
];
|
||||
|
||||
// Add dns3 if it exists in dnsServers config
|
||||
if (siteConfig?.dnsServers?.dns3) {
|
||||
topCardServices.push({ id: 'dns3', name: 'DNS3' });
|
||||
// Dynamically add all configured DNS servers from config
|
||||
for (const [id, info] of Object.entries(siteConfig?.dnsServers || {})) {
|
||||
topCardServices.push({ id, name: info.name || id.toUpperCase() });
|
||||
}
|
||||
|
||||
let appServices = [];
|
||||
|
||||
Reference in New Issue
Block a user