check if exist

Check if the file already exist, if yes modify its mode
This commit is contained in:
Yuki 2024-07-25 15:18:59 +08:00 committed by GitHub
parent 087e2c81cc
commit 54c7572447
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -90,6 +90,13 @@ export const createDefaultServerTraefikConfig = () => {
console.log("Default traefik config already exists");
return;
}
const acmeJsonPath = "/etc/dokploy/traefik/dynamic/acme.json";
if (existsSync(acmeJsonPath)) {
chmodSync(acmeJsonPath, '600');
} else {
console.error(`File not found: ${acmeJsonPath}`);
}
const appName = "dokploy";
const serviceURLDefault = `http://${appName}:${process.env.PORT || 3000}`;
@ -184,13 +191,6 @@ export const createDefaultTraefikConfig = () => {
const yamlStr = dump(configObject);
mkdirSync(MAIN_TRAEFIK_PATH, { recursive: true });
writeFileSync(mainConfig, yamlStr, "utf8");
const acmeJsonPath = "/etc/dokploy/traefik/dynamic/acme.json";
if (existsSync(acmeJsonPath)) {
chmodSync(acmeJsonPath, '600');
} else {
console.error(`File not found: ${acmeJsonPath}`);
}
};
export const createDefaultMiddlewares = () => {