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 path from "node:path";
|
||||||
import type { CreateServiceOptions } from "dockerode";
|
import type { CreateServiceOptions } from "dockerode";
|
||||||
import { dump } from "js-yaml";
|
import { dump } from "js-yaml";
|
||||||
@@ -86,17 +86,10 @@ export const initializeTraefik = async () => {
|
|||||||
|
|
||||||
export const createDefaultServerTraefikConfig = () => {
|
export const createDefaultServerTraefikConfig = () => {
|
||||||
const configFilePath = path.join(DYNAMIC_TRAEFIK_PATH, "dokploy.yml");
|
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)) {
|
if (existsSync(configFilePath)) {
|
||||||
console.log("Default traefik config already exists");
|
console.log("Default traefik config already exists");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const appName = "dokploy";
|
const appName = "dokploy";
|
||||||
@@ -133,6 +126,11 @@ export const createDefaultServerTraefikConfig = () => {
|
|||||||
|
|
||||||
export const createDefaultTraefikConfig = () => {
|
export const createDefaultTraefikConfig = () => {
|
||||||
const mainConfig = path.join(MAIN_TRAEFIK_PATH, "traefik.yml");
|
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)) {
|
if (existsSync(mainConfig)) {
|
||||||
console.log("Main config already exists");
|
console.log("Main config already exists");
|
||||||
return;
|
return;
|
||||||
@@ -192,12 +190,6 @@ export const createDefaultTraefikConfig = () => {
|
|||||||
const yamlStr = dump(configObject);
|
const yamlStr = dump(configObject);
|
||||||
mkdirSync(MAIN_TRAEFIK_PATH, { recursive: true });
|
mkdirSync(MAIN_TRAEFIK_PATH, { recursive: true });
|
||||||
writeFileSync(mainConfig, yamlStr, "utf8");
|
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 = () => {
|
export const createDefaultMiddlewares = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user