public static string CreateTraefikToml(DenTraefikService traefik, int instanceCount = 1) { string toml = @"logLevel = ""INFO"" [file] [entryPoints] [entryPoints.{0}] address = "":{1}"" {2} [entryPoints.{0}.redirect] regex = ""^http(s)?://([^/]+)/?$"" replacement = ""http$1://$2/web"" [frontends] [frontends.lucid] passHostHeader = true backend = ""lucid"" entrypoints = [""{0}""] [frontends.lucid.routes.lucid] rule = ""PathPrefixStrip:/lucid"" [frontends.lucidop] passHostHeader = true backend = ""lucid"" entrypoints = [""{0}""] [frontends.lucidop.routes.lucidop] rule = ""PathPrefix:/op"" [frontends.lucidauth] passHostHeader = true backend = ""lucid"" entrypoints = [""{0}""] [frontends.lucidauth.routes.lucidauth] rule = ""PathPrefix:/auth"" [frontends.router] passHostHeader = true backend = ""router"" entrypoints = [""{0}""] [frontends.router.routes.router] rule = ""PathPrefixStrip:/cow"" [frontends.server] passHostHeader = true backend = ""server"" entrypoints = [""{0}""] [backends] [backends.lucid] [backends.lucid.servers.lucid] url = ""http://*****:*****@" [backends.router.servers.router{instanceCount}] url = ""http://{DenIP}:4491"" method=""drr"" weight = 10 "; serverService += $@" [backends.server.servers.server{instanceCount}] url = ""http://{DenIP}:10255"" method=""drr"" weight = 10 "; } } instanceCount--; } toml += routeurService; } toml += @" [backends.server] [backends.server.servers.server] url = ""http://den-server:10255"" weight = 10 method=""drr"" " + serverService; return(string.Format(toml, traefik.Entrypoints, traefik.WaykDenPort, traefik.Tls)); }
private async Task <bool> StartTraefikService(int instanceCount = 1) { DenTraefikService traefik = new DenTraefikService(this, instanceCount); return(await this.StartService(traefik)); }