mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
fix(middleware): update domain type and improve middleware configuration
- Changed the type of the `domain` parameter in `createPathMiddlewares` from `any` to `Domain` for better type safety. - Added missing commas in middleware configuration objects to ensure proper syntax.
This commit is contained in:
parent
7f0bdc7e00
commit
113e4ae4b5
@ -6,6 +6,7 @@ import type { ApplicationNested } from "../builders";
|
||||
import { execAsyncRemote } from "../process/execAsync";
|
||||
import { writeTraefikConfigRemote } from "./application";
|
||||
import type { FileConfig } from "./file-types";
|
||||
import type { Domain } from "@dokploy/server/services/domain";
|
||||
|
||||
export const addMiddleware = (config: FileConfig, middlewareName: string) => {
|
||||
if (config.http?.routers) {
|
||||
@ -108,7 +109,7 @@ export const writeMiddleware = <T>(config: T) => {
|
||||
|
||||
export const createPathMiddlewares = async (
|
||||
app: ApplicationNested,
|
||||
domain: any
|
||||
domain: Domain,
|
||||
) => {
|
||||
let config: FileConfig;
|
||||
|
||||
@ -141,8 +142,8 @@ export const createPathMiddlewares = async (
|
||||
const middlewareName = `addprefix-${appName}-${uniqueConfigKey}`;
|
||||
config.http.middlewares[middlewareName] = {
|
||||
addPrefix: {
|
||||
prefix: internalPath
|
||||
}
|
||||
prefix: internalPath,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -151,8 +152,8 @@ export const createPathMiddlewares = async (
|
||||
const middlewareName = `stripprefix-${appName}-${uniqueConfigKey}`;
|
||||
config.http.middlewares[middlewareName] = {
|
||||
stripPrefix: {
|
||||
prefixes: [path]
|
||||
}
|
||||
prefixes: [path],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -165,7 +166,7 @@ export const createPathMiddlewares = async (
|
||||
|
||||
export const removePathMiddlewares = async (
|
||||
app: ApplicationNested,
|
||||
uniqueConfigKey: number
|
||||
uniqueConfigKey: number,
|
||||
) => {
|
||||
let config: FileConfig;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user