fix(settings): simplify letsEncryptEmail assignment and ensure router rule is always updated with new host

This commit is contained in:
Mauricio Siu
2025-12-07 20:03:54 -06:00
parent 22e6a06426
commit 28f40066a2
2 changed files with 9 additions and 4 deletions

View File

@@ -225,9 +225,7 @@ export const settingsRouter = createTRPCRouter({
}
const user = await updateUser(ctx.user.ownerId, {
host: input.host,
...(input.letsEncryptEmail && {
letsEncryptEmail: input.letsEncryptEmail,
}),
letsEncryptEmail: input.letsEncryptEmail,
certificateType: input.certificateType,
https: input.https,
});

View File

@@ -23,11 +23,18 @@ export const updateServerTraefik = (
config.http.routers = config.http.routers || {};
config.http.services = config.http.services || {};
// Get or create router config, but always update the rule with newHost
const currentRouterConfig = config.http.routers[`${appName}-router-app`] || {
rule: `Host(\`${newHost}\`)`,
service: `${appName}-service-app`,
entryPoints: ["web"],
rule: `Host(\`${newHost}\`)`,
};
// Always update the rule with the new host
if (newHost) {
currentRouterConfig.rule = `Host(\`${newHost}\`)`;
}
config.http.routers[`${appName}-router-app`] = currentRouterConfig;
config.http.services = {