summaryrefslogtreecommitdiff
path: root/cmd/authzd/main.go
blob: 00d6247f176f67b63fdbe5d2c5e04ed8a78d64a1 (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
package main

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() {
	server := grpc.NewServer()
	rpc.RegisterAbilityServer(server, &CedarServer{})
	log.Fatal(server.Serve(x.Must(net.Listen(
		"tcp",
		env.Fetch("BIND_ADDR", "localhost:50051"),
	))))
}