blob: 1e9d3a39cc671eb1f47149b46a09426892cfbcbb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package main
import (
"log"
"net/http"
"github.com/xlgmokha/x/pkg/env"
"gitlab.com/mokhax/spike/pkg/cfg"
"gitlab.com/mokhax/spike/pkg/prxy"
"gitlab.com/mokhax/spike/pkg/srv"
)
func WithRoutes() cfg.Option {
return func(c *cfg.Config) {
mux := http.NewServeMux()
mux.Handle("/", prxy.New(map[string]string{
"idp.example.com": "localhost:8282",
"ui.example.com": "localhost:8283",
"api.example.com": "localhost:8284",
}))
cfg.WithMux(mux)(c)
}
}
func main() {
log.Fatal(srv.Run(cfg.New(
env.Fetch("BIND_ADDR", ":8080"),
WithRoutes(),
)))
}
|