diff options
| author | mo khan <mo@mokhan.ca> | 2025-03-28 17:23:34 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-03-28 17:23:34 -0600 |
| commit | e47813ecaa942631945215a8c0c938a240c3894a (patch) | |
| tree | b4f39278e2f96d8aef462dc4b8cae06b6708eba2 /cmd/authzd | |
| parent | 3872736263d06fc19b6b594747c7b3879ab087b2 (diff) | |
feat: build entrypoint for golang rpc server
Diffstat (limited to 'cmd/authzd')
| -rw-r--r-- | cmd/authzd/main.go | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/cmd/authzd/main.go b/cmd/authzd/main.go index f7b60bd..00d6247 100644 --- a/cmd/authzd/main.go +++ b/cmd/authzd/main.go @@ -1,7 +1,29 @@ package main -import "fmt" +import ( + "context" + "log" + "net" + + "github.com/xlgmokha/x/pkg/env" + "github.com/xlgmokha/x/pkg/x" + "gitlab.com/mokhax/spike/pkg/rpc" + "google.golang.org/grpc" +) + +type CedarServer struct { + rpc.UnimplementedAbilityServer +} + +func (srv *CedarServer) Allowed(context.Context, *rpc.AllowRequest) (*rpc.AllowReply, error) { + return &rpc.AllowReply{Result: true}, nil +} func main() { - fmt.Println("Hello, world!") + server := grpc.NewServer() + rpc.RegisterAbilityServer(server, &CedarServer{}) + log.Fatal(server.Serve(x.Must(net.Listen( + "tcp", + env.Fetch("BIND_ADDR", "localhost:50051"), + )))) } |
