fix(lint): Add ctx shim to routes/apps and routes/arr
- routes/apps/deploy.js: Add ctx shim with APP_TEMPLATES, siteConfig, buildDomain, buildServiceUrl, addServiceToConfig, dns, notification, safeErrorMessage - routes/apps/index.js: Extract additional ctx properties for sub-routes - routes/arr/config.js: Add ctx shim with notification, safeErrorMessage + logError import - routes/arr/index.js: Extract notification, safeErrorMessage for sub-routes Result: Fixed ~30 no-undef errors (deploy.js 0 errors, arr/config.js 0 errors)
This commit is contained in:
@@ -7,6 +7,7 @@ const { isValidPort } = require('../../input-validator');
|
||||
const { exists } = require('../../fs-helpers');
|
||||
const platformPaths = require('../../platform-paths');
|
||||
const { ValidationError } = require('../errors');
|
||||
const { logError } = require('../../src/utils/logging');
|
||||
/**
|
||||
* Apps deployment routes factory
|
||||
* @param {Object} deps - Explicit dependencies
|
||||
@@ -22,8 +23,20 @@ const { ValidationError } = require('../errors');
|
||||
* @returns {express.Router}
|
||||
*/
|
||||
|
||||
module.exports = function({ docker, caddy, credentialManager, servicesStateManager, portLockManager, asyncHandler, errorResponse, log, helpers }) {
|
||||
module.exports = function({ docker, caddy, credentialManager, servicesStateManager, portLockManager, asyncHandler, errorResponse, log, helpers, APP_TEMPLATES, siteConfig, buildDomain, buildServiceUrl, addServiceToConfig, dns, notification, safeErrorMessage }) {
|
||||
const router = express.Router();
|
||||
|
||||
// Ctx shim for backward compatibility with existing route code
|
||||
const ctx = {
|
||||
APP_TEMPLATES,
|
||||
siteConfig,
|
||||
buildDomain,
|
||||
buildServiceUrl,
|
||||
addServiceToConfig,
|
||||
dns,
|
||||
notification,
|
||||
safeErrorMessage
|
||||
};
|
||||
|
||||
async function deployDashCAStaticSite(template, userConfig) {
|
||||
const destPath = platformPaths.caCertDir;
|
||||
@@ -260,6 +273,9 @@ module.exports = function({ docker, caddy, credentialManager, servicesStateManag
|
||||
|
||||
let containerId;
|
||||
let usedExisting = false;
|
||||
|
||||
// Process template variables for manifest (only needed for Docker containers)
|
||||
const processedTemplate = template.isStaticSite ? null : helpers.processTemplateVariables(template, config);
|
||||
|
||||
if (template.isStaticSite) {
|
||||
log.info('deploy', 'Deploying static site', { appId });
|
||||
|
||||
@@ -23,7 +23,16 @@ module.exports = function(ctx) {
|
||||
portLockManager: ctx.portLockManager,
|
||||
asyncHandler: ctx.asyncHandler,
|
||||
errorResponse: ctx.errorResponse,
|
||||
log: ctx.log
|
||||
log: ctx.log,
|
||||
// Additional context properties needed by routes
|
||||
APP_TEMPLATES: ctx.APP_TEMPLATES,
|
||||
siteConfig: ctx.siteConfig,
|
||||
buildDomain: ctx.buildDomain,
|
||||
buildServiceUrl: ctx.buildServiceUrl,
|
||||
addServiceToConfig: ctx.addServiceToConfig,
|
||||
dns: ctx.dns,
|
||||
notification: ctx.notification,
|
||||
safeErrorMessage: ctx.safeErrorMessage
|
||||
};
|
||||
|
||||
// Initialize helpers with dependencies
|
||||
|
||||
Reference in New Issue
Block a user