Skip to content

Commit

Permalink
feat: allow tls
Browse files Browse the repository at this point in the history
  • Loading branch information
scmmishra committed Dec 6, 2023
1 parent 26b15b5 commit 4d02f29
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/caddy/caddy.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ func ConvertToCaddyfile(caddyCfg config.CaddyConfig, port int) string {
for _, rule := range caddyCfg.Rules {
caddyfileBuilder.WriteString(rule.Match)
caddyfileBuilder.WriteString(" {\n")
if rule.Tls != "" {
caddyfileBuilder.WriteString(fmt.Sprintf(" tls {\n %s\n }\n", rule.Tls))
}

for _, proxy := range rule.ReverseProxy {
toPath := strings.ReplaceAll(proxy.To, "{port}", fmt.Sprintf("%d", port))

Expand All @@ -36,6 +40,8 @@ func ConvertToCaddyfile(caddyCfg config.CaddyConfig, port int) string {
caddyfileBuilder.WriteString("}\n")
}

fmt.Println(caddyfileBuilder.String())

return caddyfileBuilder.String()
}

Expand Down

0 comments on commit 4d02f29

Please sign in to comment.