mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-09-12 19:51:00 +05:00
fix: surface certificate resolver discovery errors
Propagate SSH, filesystem, and YAML errors so unavailable resolver configuration is not mistaken for an empty one. Not-tested: Local checks unavailable because node_modules is missing
This commit is contained in:
parent
987331d89a
commit
64e07d7bd0
@ -113,28 +113,24 @@ export const readMainConfig = () => {
|
||||
export const getCertificateResolvers = async (
|
||||
serverId?: string | null,
|
||||
): Promise<string[]> => {
|
||||
try {
|
||||
let yamlStr: string | null = null;
|
||||
if (serverId) {
|
||||
const { MAIN_TRAEFIK_PATH } = paths(true);
|
||||
const configPath = join(MAIN_TRAEFIK_PATH, "traefik.yml");
|
||||
const { stdout } = await execAsyncRemote(serverId, `cat ${configPath}`);
|
||||
yamlStr = stdout || null;
|
||||
} else {
|
||||
yamlStr = readMainConfig();
|
||||
}
|
||||
if (!yamlStr) return [];
|
||||
const config = parse(yamlStr) as MainTraefikConfig;
|
||||
if (
|
||||
!config?.certificatesResolvers ||
|
||||
typeof config.certificatesResolvers !== "object"
|
||||
) {
|
||||
return [];
|
||||
}
|
||||
return Object.keys(config.certificatesResolvers);
|
||||
} catch {
|
||||
let yamlStr: string | null = null;
|
||||
if (serverId) {
|
||||
const { MAIN_TRAEFIK_PATH } = paths(true);
|
||||
const configPath = join(MAIN_TRAEFIK_PATH, "traefik.yml");
|
||||
const { stdout } = await execAsyncRemote(serverId, `cat ${configPath}`);
|
||||
yamlStr = stdout || null;
|
||||
} else {
|
||||
yamlStr = readMainConfig();
|
||||
}
|
||||
if (!yamlStr) return [];
|
||||
const config = parse(yamlStr) as MainTraefikConfig;
|
||||
if (
|
||||
!config?.certificatesResolvers ||
|
||||
typeof config.certificatesResolvers !== "object"
|
||||
) {
|
||||
return [];
|
||||
}
|
||||
return Object.keys(config.certificatesResolvers);
|
||||
};
|
||||
|
||||
export const writeMainConfig = (traefikConfig: string) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user