diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-02 17:09:57 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-02 17:09:57 -0600 |
| commit | 9c54e9690a9babcd512fdad844251bb8f45e1691 (patch) | |
| tree | f4a658069d5ce9058c67faa766f67fe3a44982df | |
| parent | 9df901bbc89d5017b0423e15ddad2f7365b6f3ff (diff) | |
fix: check if an authzd host is provided
| -rw-r--r-- | cmd/authzd/main.go | 4 | ||||
| -rw-r--r-- | pkg/authz/server.go | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/cmd/authzd/main.go b/cmd/authzd/main.go index ff942e7..37d2cf5 100644 --- a/cmd/authzd/main.go +++ b/cmd/authzd/main.go @@ -49,6 +49,10 @@ func main() { } func credentialsFor(ctx context.Context, host string) credentials.TransportCredentials { + if host == "" { + return insecure.NewCredentials() + } + _, port, err := net.SplitHostPort(host) if err != nil { pls.LogError(ctx, err) diff --git a/pkg/authz/server.go b/pkg/authz/server.go index 05580b0..24d6b0c 100644 --- a/pkg/authz/server.go +++ b/pkg/authz/server.go @@ -28,12 +28,8 @@ func New(ctx context.Context, options ...grpc.ServerOption) *Server { )...) connection := Connection.From(ctx) + if x.IsZero(connection) { - pls.LogNow(ctx, log.Fields{"remote-authzd": "not connected"}) - pls.LogNow(ctx, log.Fields{"authzd": map[string]string{ - "target": "unknown", - "state": "invalid", - }}) auth.RegisterAuthorizationServer(server, NewCheckService(nil)) } else { pls.LogNow(ctx, log.Fields{"authzd": map[string]string{ |
