[ANN] warp-tls-simple: for easily running HTTP/2 servers

Background: For better SSE (servant sent events) performance, I needed to switch to HTTP/2 which further required HTTPS even when running locally. So I created something that creates self-signed certs (using openssl, Nix package) on application startup and launches Warp with https configured … all with minimal lines of code (hence the -simple prefix).

Full documentation here: Network.Wai.Handler.WarpTLS.Simple

Source: GitHub - srid/warp-tls-simple

6 Likes

Looks nice! I can see this being useful when working on backend APIs, for sure.

I do wonder why the relude and text dependencies are in the package. I don’t see them being imported in the one module the package has :thinking:
Have you tried building with -Wunused-packages? I always find it helpful to keep the dependencies in check.

2 Likes

I’ve released a new version without relude and text: warp-tls-simple: Simple TLS configuration for Warp

I use relude in my applications, but for published libraries it doesn’t make much sense to use a custom prelude.

TIL, thanks. But this is only useful with -Werror, right? I cannot make nix build fail without also tacking in a -Werror (however, that would prevent the library from being published to hackage).

1 Like

I mostly meant that when developing the library, using that warning will tell you you’re not using certain dependencies. Which you can then remove.

Also, I always get a bit sad when a library doesn’t have a ChangeLog. Though in this case the library is small enough to not make it a big issue.

All in all: good addition to the ecosystem :+1: Thanks

1 Like

The ChangeLog is in the source, just not in cabal file (by accident). I’ve been meaning to write a ‘releaser’ tool – or at least find an existing one – that sanity check things like this before doing cabal upload.

1 Like

Typically, you’d still be developing with -Werror, even for libraries. You could add it on the command line, in cabal.project/stack.yaml, or under a flag in .cabal

1 Like