summaryrefslogtreecommitdiff
path: root/cmd/gtwy/main.go
blob: 84c9f183bc8d2b74eb4567452dd0d1ddd2e4f4c7 (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
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 main() {
	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",
	}))

	log.Fatal(srv.Run(cfg.New(
		env.Fetch("BIND_ADDR", ":8080"),
		cfg.WithMux(mux),
	)))
}