restic / rest-server

Rest Server is a high performance HTTP server that implements restic's REST backend API.
BSD 2-Clause "Simplified" License
899 stars 139 forks source link

Enhancement: add support for unix socket listen #272

Closed ae-govau closed 4 months ago

ae-govau commented 5 months ago

What is the purpose of this change? What does it change?

Enhancement: add support for unix socket listen

Refactor main for easier testing, graceful termination and be able to prin the listening port after startup.

Add tests for both TCP and Unix socket listening.

The change to add unix socket listening was pretty simple, but the PR got bit bigger then I made some refactors to main.go to make it easier for testing (by removing use of gloabl variables).

Was the change discussed in an issue or in the forum before?

Yes. This is the rest-server part of https://github.com/restic/restic/issues/4287

(it also includes the tiny change I proposed in #271)

Checklist

ae-govau commented 5 months ago

Split PR as requestd. Note this PR currently has 2 commits, the first is also in separate PR #273 , but the test added in this PR for the new functionality needs it, so I've included it here.

Once #273 lands, I can rebase this one.

MichaelEischer commented 4 months ago

Can you rebase the PR now that #273 is merged?

ae-govau commented 4 months ago

Rebased. Tests are failing due to calens not supporting a syntax specified on a verbatim tag. Happy to either remove that here, else I've made a PR to calens to support: https://github.com/restic/calens/pull/18