Skip to content
Snippets Groups Projects
Verified Commit 619e77df authored by meskio's avatar meskio :tent:
Browse files

[feat] use $SNAP if defined for the socket path

- Resolves: #16
parent fb99b434
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,9 @@ package bitmask
import (
"encoding/json"
"errors"
"fmt"
"log"
"os"
"time"
"github.com/pebbe/zmq4"
......@@ -26,7 +28,7 @@ import (
const (
// On win should be: tcp://127.0.0.1:5001
coreEndpoint = "ipc:///tmp/bitmask.core.sock"
coreEndpoint = "ipc://%s/bitmask.core.sock"
timeout = time.Second * 40
)
......@@ -100,6 +102,10 @@ func initCore() (*zmq4.Socket, error) {
return nil, err
}
err = socket.Connect(coreEndpoint)
endpointPwd := "/tmp"
if os.Getenv("SNAP") != "" {
endpointPwd = os.Getenv("SNAP")
}
err = socket.Connect(fmt.Sprintf(coreEndpoint, endpointPwd))
return socket, err
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment