Search code examples
sslgotls1.2go-swagger

go-swagger TLS Config


I generated a golang server with go-swagger. I set the scheme to https (and only https). When I startup my server I get a TLS error.

the required flags `--tls-certificate` and `--tls-key` were not specified

It is clear that I haven't properly set my TLS flags but I really don't know the best way to to do this in go with go-swagger.

Anyone have any experience setting up TLS with go-swagger as I couldn't find any good links?

Thank you.


Solution

  • When you get certificates you get a private key file and a public key (certificate) file.

    Here's an example of how they are used: https://github.com/go-swagger/go-swagger/tree/master/examples/todo-list#run-full-server

    ./todo-list-server --tls-certificate mycert1.crt --tls-key mycert1.key