diff options
| author | mo khan <mo@mokhan.ca> | 2025-05-23 14:54:24 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-05-23 14:54:24 -0600 |
| commit | 3d6cdf0b3d6fa23509208e2355a7b7d26400a8ea (patch) | |
| tree | 039bdf57b99061844aeb0fe55ad0bc1c864166af /cmd | |
| parent | 0ba49bfbde242920d8675a193d7af89420456fc0 (diff) | |
| parent | 4beee46dc6c7642316e118a4d3aa51e4b407256e (diff) | |
Merge branch 'envoy-jwt-authn' into 'main'
Add External Authorization Service with Envoy Integration
See merge request gitlab-org/software-supply-chain-security/authorization/sparkled!9
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/authzd/main.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cmd/authzd/main.go b/cmd/authzd/main.go new file mode 100644 index 0000000..65a4672 --- /dev/null +++ b/cmd/authzd/main.go @@ -0,0 +1,33 @@ +package main + +import ( + "context" + "net" + "os" + "os/signal" + "syscall" + + "github.com/xlgmokha/x/pkg/log" + "github.com/xlgmokha/x/pkg/x" + "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/authz" + "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/pls" +) + +func main() { + logger := log.New(os.Stdout, log.Fields{"app": "authzd"}) + ctx := logger.WithContext(context.Background()) + server := authz.New(ctx) + + c := make(chan os.Signal, 1) + signal.Notify(c, syscall.SIGINT, syscall.SIGTERM) + go func() { + <-c + pls.LogNow(ctx, log.Fields{"status": "goodbye"}) + server.GracefulStop() + }() + + defer server.GracefulStop() + pls.LogNow(ctx, log.Fields{"status": "ready"}) + socket := x.Must(net.Listen("tcp", ":10003")) + pls.LogErrorNow(ctx, server.Serve(socket)) +} |
