MCPcopy
hub / github.com/Dokploy/dokploy / createDefaultTraefikConfig

Function createDefaultTraefikConfig

packages/server/src/setup/traefik-setup.ts:377–405  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

375};
376
377export const createDefaultTraefikConfig = () => {
378 const { MAIN_TRAEFIK_PATH, DYNAMIC_TRAEFIK_PATH } = paths();
379 const mainConfig = path.join(MAIN_TRAEFIK_PATH, "traefik.yml");
380 const acmeJsonPath = path.join(DYNAMIC_TRAEFIK_PATH, "acme.json");
381
382 if (existsSync(acmeJsonPath)) {
383 chmodSync(acmeJsonPath, "600");
384 }
385
386 // Create the traefik directory first
387 mkdirSync(MAIN_TRAEFIK_PATH, { recursive: true });
388
389 // Check if traefik.yml exists and handle the case where it might be a directory
390 if (existsSync(mainConfig)) {
391 const stats = statSync(mainConfig);
392 if (stats.isDirectory()) {
393 // If traefik.yml is a directory, remove it
394 console.log("Found traefik.yml as directory, removing it...");
395 rmSync(mainConfig, { recursive: true, force: true });
396 } else if (stats.isFile()) {
397 console.log("Main config already exists");
398 return;
399 }
400 }
401
402 const yamlStr = getDefaultTraefikConfig();
403 writeFileSync(mainConfig, yamlStr, "utf8");
404 console.log("Traefik config created successfully");
405};
406
407export const getDefaultMiddlewares = () => {
408 const defaultMiddlewares = {

Callers 2

setup.tsFile · 0.90
server.tsFile · 0.90

Calls 2

pathsFunction · 0.90
getDefaultTraefikConfigFunction · 0.85

Tested by

no test coverage detected