mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-27 12:05:26 +00:00
Give user better feedback if headscale socket is unwritable
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
ca8bca98ed
commit
21ec543d37
@ -81,6 +81,19 @@ func getHeadscaleCLIClient() (context.Context, v1.HeadscaleServiceClient, *grpc.
|
|||||||
|
|
||||||
address = cfg.UnixSocket
|
address = cfg.UnixSocket
|
||||||
|
|
||||||
|
// Try to give the user better feedback if we cannot write to the headscale
|
||||||
|
// socket.
|
||||||
|
socket, err := os.OpenFile(cfg.UnixSocket, os.O_WRONLY, 0o666)
|
||||||
|
if err != nil {
|
||||||
|
if os.IsPermission(err) {
|
||||||
|
log.Fatal().
|
||||||
|
Err(err).
|
||||||
|
Str("socket", cfg.UnixSocket).
|
||||||
|
Msgf("Unable to read/write to headscale socket, do you have the correct permissions?")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
socket.Close()
|
||||||
|
|
||||||
grpcOptions = append(
|
grpcOptions = append(
|
||||||
grpcOptions,
|
grpcOptions,
|
||||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||||
|
Loading…
Reference in New Issue
Block a user