mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor(traefik-setup): change order of chmodsync
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { existsSync, mkdirSync, writeFileSync, chmodSync } from "node:fs";
|
||||
import { chmodSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import type { CreateServiceOptions } from "dockerode";
|
||||
import { dump } from "js-yaml";
|
||||
@@ -86,17 +86,10 @@ export const initializeTraefik = async () => {
|
||||
|
||||
export const createDefaultServerTraefikConfig = () => {
|
||||
const configFilePath = path.join(DYNAMIC_TRAEFIK_PATH, "dokploy.yml");
|
||||
const acmeJsonPath = path.join(DYNAMIC_TRAEFIK_PATH, "acme.json");
|
||||
|
||||
if (existsSync(acmeJsonPath)) {
|
||||
chmodSync(acmeJsonPath, '600');
|
||||
} else {
|
||||
console.error(`File not found: ${acmeJsonPath}`);
|
||||
}
|
||||
|
||||
|
||||
if (existsSync(configFilePath)) {
|
||||
console.log("Default traefik config already exists");
|
||||
return;
|
||||
console.log("Default traefik config already exists");
|
||||
return;
|
||||
}
|
||||
|
||||
const appName = "dokploy";
|
||||
@@ -133,6 +126,11 @@ export const createDefaultServerTraefikConfig = () => {
|
||||
|
||||
export const createDefaultTraefikConfig = () => {
|
||||
const mainConfig = path.join(MAIN_TRAEFIK_PATH, "traefik.yml");
|
||||
const acmeJsonPath = path.join(DYNAMIC_TRAEFIK_PATH, "acme.json");
|
||||
|
||||
if (existsSync(acmeJsonPath)) {
|
||||
chmodSync(acmeJsonPath, "600");
|
||||
}
|
||||
if (existsSync(mainConfig)) {
|
||||
console.log("Main config already exists");
|
||||
return;
|
||||
@@ -192,12 +190,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}, func createDefaultTraefikConfig`);
|
||||
}
|
||||
};
|
||||
|
||||
export const createDefaultMiddlewares = () => {
|
||||
|
||||
Reference in New Issue
Block a user