mdouchement / standardfile

Yet Another Standardfile (standardnotes server) Implementation written in Golang
MIT License
80 stars 9 forks source link

unix socket support #62

Closed cyberb closed 2 years ago

cyberb commented 2 years ago

Looks like it is not possible to listen on unix socket

Error message:

Error: could not run server: listen tcp: address /var/snap/notes/current/notes.socket: missing port in address

Could you help?

mdouchement commented 2 years ago

Yes, this project uses Echo framework that only supports tcp, tcp4 & tcp6 network types which is the common use case for HTTP servers.

That said, it may be possible to listen over a unix socket by replacing: https://github.com/mdouchement/standardfile/blob/master/cmd/standardfile/main.go#L148-L151

With the following code:

listener, err := net.Listen("unix", konf.String("address"))
if err != nil {
    return err
}
return engine.Server.Serve(listener)

This Gist https://gist.github.com/teknoraver/5ffacb8757330715bcbcc90e6d46ac74 describes how to serves HTTP server over a unix socket.