Fix command get policy works with relative policy path (#2051)

This commit is contained in:
Chuangbo Li 2024-08-12 18:11:59 +08:00 committed by GitHub
parent fcd1183805
commit 022fb24cd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -692,7 +692,8 @@ func (api headscaleV1APIServer) GetPolicy(
}, nil
case types.PolicyModeFile:
// Read the file and return the contents as-is.
f, err := os.Open(api.h.cfg.Policy.Path)
absPath := util.AbsolutePathFromConfigPath(api.h.cfg.Policy.Path)
f, err := os.Open(absPath)
if err != nil {
return nil, err
}