Move the acme cert sync

This commit is contained in:
Owen
2026-08-14 16:44:18 -04:00
parent 24998ce0a1
commit b4c509e8f6
5 changed files with 925 additions and 894 deletions
+37
View File
@@ -19,6 +19,9 @@ import {
privateConfigSchema,
readPrivateConfigFile
} from "#private/lib/readConfigFile";
import config from "@server/lib/config";
import { readConfigFile as readPublicConfigFile } from "@server/lib/readConfigFile";
import logger from "@server/logger";
export class PrivateConfig {
private rawPrivateConfig!: z.infer<typeof privateConfigSchema>;
@@ -45,6 +48,8 @@ export class PrivateConfig {
this.rawPrivateConfig = parsedPrivateConfig;
this.migrateDeprecatedAcmeConfig(privateEnvironment);
process.env.BRANDING_HIDE_AUTH_LAYOUT_FOOTER =
this.rawPrivateConfig.branding?.hide_auth_layout_footer === true
? "true"
@@ -146,6 +151,38 @@ export class PrivateConfig {
public getRawPrivateConfig() {
return this.rawPrivateConfig;
}
// `flags.enable_acme_cert_sync` and `acme` used to live in the private
// config file. They now live in the public config file. If an operator
// still has them set in the private config and hasn't moved them over to
// the public config, pull them forward so behavior doesn't silently
// change out from under them.
private migrateDeprecatedAcmeConfig(privateEnvironment: any) {
const publicEnvironment: any = readPublicConfigFile();
const rawConfig: any = config.getRawConfig();
if (
privateEnvironment?.flags?.enable_acme_cert_sync !== undefined &&
publicEnvironment?.flags?.enable_acme_cert_sync === undefined
) {
logger.warn(
"`flags.enable_acme_cert_sync` is deprecated in the private config file and has moved to the public config file. Using the value from the private config file for now, but please move it to the public config."
);
rawConfig.flags = rawConfig.flags ?? {};
rawConfig.flags.enable_acme_cert_sync =
this.rawPrivateConfig.flags.enable_acme_cert_sync;
}
if (
privateEnvironment?.acme !== undefined &&
publicEnvironment?.acme === undefined
) {
logger.warn(
"`acme` is deprecated in the private config file and has moved to the public config file. Using the value from the private config file for now, but please move it to the public config."
);
rawConfig.acme = this.rawPrivateConfig.acme;
}
}
}
export const privateConfig = new PrivateConfig();