diff --git a/docker-compose.yml b/docker-compose.yml index 44e1886..e379658 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,11 @@ services: ports: - 8088:8080 container_name: oc-workflow + labels: + - "traefik.enable=true" + - "traefik.http.middlewares.workflow.forwardauth.address=http://oc-auth:8080/oc/forward" + - "traefik.http.middlewares.workflow.forwardauth.authResponseHeaders=X-Forwarded-User" + - "traefik.http.services.workflow.loadbalancer.server.port=8080" networks: - catalog diff --git a/go.mod b/go.mod index b50c076..451ce9e 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.22.0 toolchain go1.22.4 require ( - cloud.o-forge.io/core/oc-lib v0.0.0-20241015083538-9f5e6d60185a + cloud.o-forge.io/core/oc-lib v0.0.0-20241030091613-1a5521237800 github.com/beego/beego/v2 v2.3.1 github.com/nats-io/nats.go v1.37.0 github.com/smartystreets/goconvey v1.7.2 @@ -37,9 +37,9 @@ require ( github.com/nats-io/nkeys v0.4.7 // indirect github.com/nats-io/nuid v1.0.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.2 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.58.0 // indirect + github.com/prometheus/common v0.60.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect diff --git a/go.sum b/go.sum index c879769..7bbcb13 100644 --- a/go.sum +++ b/go.sum @@ -72,6 +72,16 @@ cloud.o-forge.io/core/oc-lib v0.0.0-20241009111931-84024a143e67 h1:0CMdmukFqTrGv cloud.o-forge.io/core/oc-lib v0.0.0-20241009111931-84024a143e67/go.mod h1:t+zpCTVKVdHH/BImwtMYY2QIWLMXKgY4n/JhFm3Vpu8= cloud.o-forge.io/core/oc-lib v0.0.0-20241015083538-9f5e6d60185a h1:2mBMc36WKh1/Dpomktx9dVXGxK0agFr7RdgvHTtyn2w= cloud.o-forge.io/core/oc-lib v0.0.0-20241015083538-9f5e6d60185a/go.mod h1:t+zpCTVKVdHH/BImwtMYY2QIWLMXKgY4n/JhFm3Vpu8= +cloud.o-forge.io/core/oc-lib v0.0.0-20241017121404-847ef2e95c64 h1:iPyRjeEiQD0lo40OlboBeVZke7zw+uYCvqcPdq+p60E= +cloud.o-forge.io/core/oc-lib v0.0.0-20241017121404-847ef2e95c64/go.mod h1:t+zpCTVKVdHH/BImwtMYY2QIWLMXKgY4n/JhFm3Vpu8= +cloud.o-forge.io/core/oc-lib v0.0.0-20241017121618-1561d0c81e9d h1:BagZaE9jASefM9u5Hf/xyWXXJEd2/xwmRzL6GFy6nqg= +cloud.o-forge.io/core/oc-lib v0.0.0-20241017121618-1561d0c81e9d/go.mod h1:t+zpCTVKVdHH/BImwtMYY2QIWLMXKgY4n/JhFm3Vpu8= +cloud.o-forge.io/core/oc-lib v0.0.0-20241017140500-73fce1d8fb8d h1:ZnXPVbPYXVS/lWOf+aAPnHwQMpzKoIoowLdzsZ08Hi8= +cloud.o-forge.io/core/oc-lib v0.0.0-20241017140500-73fce1d8fb8d/go.mod h1:t+zpCTVKVdHH/BImwtMYY2QIWLMXKgY4n/JhFm3Vpu8= +cloud.o-forge.io/core/oc-lib v0.0.0-20241017150409-3c54f3d39ee8 h1:5Lx4J+ict5ge+Q4vQdytpIm7AghAno3VPSQRuqWus7Q= +cloud.o-forge.io/core/oc-lib v0.0.0-20241017150409-3c54f3d39ee8/go.mod h1:t+zpCTVKVdHH/BImwtMYY2QIWLMXKgY4n/JhFm3Vpu8= +cloud.o-forge.io/core/oc-lib v0.0.0-20241030091613-1a5521237800 h1:uZ4Qrxk/KEpOfDq8QHjZankW7aZGLlDYLoM3CZowlR8= +cloud.o-forge.io/core/oc-lib v0.0.0-20241030091613-1a5521237800/go.mod h1:t+zpCTVKVdHH/BImwtMYY2QIWLMXKgY4n/JhFm3Vpu8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/beego/beego/v2 v2.3.0 h1:iECVwzm6egw6iw6tkWrEDqXG4NQtKLQ6QBSYqlM6T/I= github.com/beego/beego/v2 v2.3.0/go.mod h1:Ob/5BJ9fIKZLd4s9ZV3o9J6odkkIyL83et+p98gyYXo= @@ -171,10 +181,16 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.58.0 h1:N+N8vY4/23r6iYfD3UQZUoJPnUYAo7v6LG5XZxjZTXo= github.com/prometheus/common v0.58.0/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0= +github.com/prometheus/common v0.60.0 h1:+V9PAREWNvJMAuJ1x1BaWl9dewMW4YrHZQbx0sJNllA= +github.com/prometheus/common v0.60.0/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= +github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc= +github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= diff --git a/main.go b/main.go index 3529e63..0ffd4be 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ import ( _ "oc-workflow/routers" oclib "cloud.o-forge.io/core/oc-lib" + "cloud.o-forge.io/core/oc-lib/tools" beego "github.com/beego/beego/v2/server/web" ) @@ -29,6 +30,9 @@ func main() { beego.BConfig.Listen.HTTPPort = o.GetIntDefault("port", 8080) beego.BConfig.WebConfig.DirectoryIndex = true beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger" + api := &tools.API{} + api.Discovered(beego.BeeApp.Handlers.GetAllControllerInfo()) beego.Run() + } diff --git a/routers/router.go b/routers/router.go index c1b07a9..c751fba 100644 --- a/routers/router.go +++ b/routers/router.go @@ -24,6 +24,5 @@ func init() { ), ), ) - beego.AddNamespace(ns) }