mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
feat(#130): allow to pass enviroment variables to assign custom port on traefik
This commit is contained in:
@@ -7,6 +7,10 @@ import type { MainTraefikConfig } from "../utils/traefik/types";
|
|||||||
import type { FileConfig } from "../utils/traefik/file-types";
|
import type { FileConfig } from "../utils/traefik/file-types";
|
||||||
import type { CreateServiceOptions } from "dockerode";
|
import type { CreateServiceOptions } from "dockerode";
|
||||||
|
|
||||||
|
const TRAEFIK_SSL_PORT =
|
||||||
|
Number.parseInt(process.env.TRAEFIK_SSL_PORT ?? "", 10) || 443;
|
||||||
|
const TRAEFIK_PORT = Number.parseInt(process.env.TRAEFIK_PORT ?? "", 10) || 80;
|
||||||
|
|
||||||
export const initializeTraefik = async () => {
|
export const initializeTraefik = async () => {
|
||||||
const imageName = "traefik:v2.5";
|
const imageName = "traefik:v2.5";
|
||||||
const containerName = "dokploy-traefik";
|
const containerName = "dokploy-traefik";
|
||||||
@@ -47,12 +51,12 @@ export const initializeTraefik = async () => {
|
|||||||
Ports: [
|
Ports: [
|
||||||
{
|
{
|
||||||
TargetPort: 443,
|
TargetPort: 443,
|
||||||
PublishedPort: 443,
|
PublishedPort: TRAEFIK_SSL_PORT,
|
||||||
PublishMode: "host",
|
PublishMode: "host",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
TargetPort: 80,
|
TargetPort: 80,
|
||||||
PublishedPort: 80,
|
PublishedPort: TRAEFIK_PORT,
|
||||||
PublishMode: "host",
|
PublishMode: "host",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -146,10 +150,10 @@ export const createDefaultTraefikConfig = () => {
|
|||||||
},
|
},
|
||||||
entryPoints: {
|
entryPoints: {
|
||||||
web: {
|
web: {
|
||||||
address: ":80",
|
address: `:${TRAEFIK_PORT}`,
|
||||||
},
|
},
|
||||||
websecure: {
|
websecure: {
|
||||||
address: ":443",
|
address: `:${TRAEFIK_SSL_PORT}`,
|
||||||
...(process.env.NODE_ENV === "production" && {
|
...(process.env.NODE_ENV === "production" && {
|
||||||
http: {
|
http: {
|
||||||
tls: {
|
tls: {
|
||||||
|
|||||||
Reference in New Issue
Block a user