summaryrefslogtreecommitdiff
path: root/pkg/app/app.go
blob: 89a2bd34ec30c1044909895c0eeaf294574c76c1 (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 app

import (
	"os"

	"github.com/xlgmokha/x/pkg/log"
	"gitlab.com/mokhax/spike/pkg/authz"
	"gitlab.com/mokhax/spike/pkg/cfg"
	"gitlab.com/mokhax/spike/pkg/srv"
)

func Start(bindAddr string) error {
	logger := log.New(os.Stdout, log.Fields{"app": "gtwy"})
	mux := authz.HTTP(authz.WithCasbin(), Routes())
	return srv.Run(cfg.New(
		bindAddr,
		cfg.WithMux(log.HTTP(logger)(mux)),
		cfg.WithTLS([]string{
			"api.example.com",
			"authzd.example.com",
			"idp.example.com",
			"ui.example.com",
		}),
	))
}