mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
fix(traefik): update server configuration to use new host parameter and ensure HTTPS is set correctly
- Modified the updateServerTraefik function to utilize the newHost parameter instead of user.host. - Ensured the HTTPS field is correctly initialized in the test for server configuration.
This commit is contained in:
parent
e5a3e56e13
commit
bca6af77fd
@ -74,7 +74,6 @@ beforeEach(() => {
|
||||
|
||||
test("Should read the configuration file", () => {
|
||||
const config: FileConfig = loadOrCreateConfig("dokploy");
|
||||
|
||||
expect(config.http?.routers?.["dokploy-router-app"]?.service).toBe(
|
||||
"dokploy-service-app",
|
||||
);
|
||||
@ -84,6 +83,7 @@ test("Should apply redirect-to-https", () => {
|
||||
updateServerTraefik(
|
||||
{
|
||||
...baseAdmin,
|
||||
https: true,
|
||||
certificateType: "letsencrypt",
|
||||
},
|
||||
"example.com",
|
||||
|
@ -15,7 +15,7 @@ export const updateServerTraefik = (
|
||||
user: User | null,
|
||||
newHost: string | null,
|
||||
) => {
|
||||
const { https, host, certificateType } = user || {};
|
||||
const { https, certificateType } = user || {};
|
||||
const appName = "dokploy";
|
||||
const config: FileConfig = loadOrCreateConfig(appName);
|
||||
|
||||
@ -24,7 +24,7 @@ export const updateServerTraefik = (
|
||||
config.http.services = config.http.services || {};
|
||||
|
||||
const currentRouterConfig = config.http.routers[`${appName}-router-app`] || {
|
||||
rule: `Host(\`${host}\`)`,
|
||||
rule: `Host(\`${newHost}\`)`,
|
||||
service: `${appName}-service-app`,
|
||||
entryPoints: ["web"],
|
||||
};
|
||||
@ -66,7 +66,7 @@ export const updateServerTraefik = (
|
||||
currentRouterConfig.middlewares = [];
|
||||
}
|
||||
|
||||
if (user?.host) {
|
||||
if (newHost) {
|
||||
writeTraefikConfig(config, appName);
|
||||
} else {
|
||||
removeTraefikConfig(appName);
|
||||
|
Loading…
Reference in New Issue
Block a user