From 0fa96af3d17fb3baeb46d64899ad562174e180cd Mon Sep 17 00:00:00 2001 From: Pablu23 Date: Wed, 1 Oct 2025 09:49:14 +0200 Subject: [PATCH] Add kdl config, but not runnable --- config.go | 39 +++++++++++++++--------------- config.kdl | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 20 deletions(-) create mode 100644 config.kdl diff --git a/config.go b/config.go index 71ea914..366feeb 100644 --- a/config.go +++ b/config.go @@ -1,29 +1,28 @@ package domainrouter +type Location struct { + +} + type Config struct { Server struct { - Port int `yaml:"port"` + Port int `yaml:"port" kdl:"port"` Ssl struct { - Enabled bool `yaml:"enabled"` - CertFile string `yaml:"certFile"` - KeyFile string `yaml:"keyFile"` + Enabled bool `yaml:"enabled" kdl:"enabled"` + CertFile string `yaml:"certFile" kdl:"cert-file"` + KeyFile string `yaml:"keyFile" kdl:"key-file"` Acme struct { - Enabled bool `yaml:"enabled"` - Email string `yaml:"email"` - KeyFile string `yaml:"keyFile"` - CADirURL string `yaml:"caDirUrl"` - Http01Port string `yaml:"http01Port"` - TlsAlpn01Port string `yaml:"tlsAlpn01Port"` - RenewTime string `yaml:"renewTime"` - } `yaml:"acme"` - } `yaml:"ssl"` - } `yaml:"server"` - Hosts []struct { - Port int `yaml:"port"` - Remotes []string `yaml:"remotes"` - Domains []string `yaml:"domains"` - Secure bool `yaml:"secure"` - } `yaml:"hosts"` + Enabled bool `yaml:"enabled" kdl:"enabled"` + Email string `yaml:"email" kdl:"email"` + KeyFile string `yaml:"keyFile" kdl:"key-file"` + CADirURL string `yaml:"caDirUrl" kdl:"ca-dir-url"` + Http01Port string `yaml:"http01Port" kdl:"http-01-port"` + TlsAlpn01Port string `yaml:"tlsAlpn01Port" kdl:"tls-apln01-port"` + RenewTime string `yaml:"renewTime" kdl:"renew-time"` + } `yaml:"acme" kdl:"acme"` + } `yaml:"ssl" kdl:"ssl"` + } `yaml:"server" kdl:"server"` + RateLimit struct { Enabled bool `yaml:"enabled"` BucketSize int `yaml:"bucketSize"` diff --git a/config.kdl b/config.kdl new file mode 100644 index 0000000..c1d4144 --- /dev/null +++ b/config.kdl @@ -0,0 +1,71 @@ +server { + port 443 + ssl { + enabled true + cert-file "server.crt" + key-file "server.key" + + acme { + email "me@pablu.de" + key-file "userKey.key" + ca-dir-url "https://192.168.2.154:14000/dir" + tls-alpn01-port 5001 + http-01-port 5002 + renew-time "30s" + } + } +} + +logging { + level "trace" + pretty true + requests true + file { + enabled false + max-age 14 + max-backups 10 + path "~/logs/router" + } +} + +rate-limit { + enabled false + bucket-size 50 + refill-size 50 + refill-time "30s" + cleanup-time "45s" +} + +location "test.localhost" "localhost" { + port 8181 + remote "localhost" +} + +location "private.localhost" { + port 8282 + remote "localhost" +} + +location "api.hitstar.localhost" { + port 9090 + remote "localhost" +} + +location "hitstar.localhost" "hipstar.localhost" { + port 5173 + remote "localhost" + rewrite "/api" { + location "api.hitstar.localhost" + } + rewrite "/public" { + port 9090 + remote "localhost" + keep-sub true + } +} + +location "chat.localhost" { + port 46009 + secure true + remote "localhost" "chat.pablu.de" +}