]> git.maquefel.me Git - brevno-suite/hugo/commit
commands: Add TLS/HTTPS support to hugo server
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 5 Jun 2023 07:53:53 +0000 (09:53 +0200)
committerGitHub <noreply@github.com>
Mon, 5 Jun 2023 07:53:53 +0000 (09:53 +0200)
commitcf38c73f53bd7f2093d4ae34a9c324f5e915b7c8
tree2e4b0efc37642330dadc1b68358e88f069bae3a6
parent536bf71abe861a74354a62eb880529a44434a4fa
commands: Add TLS/HTTPS support to hugo server

* commands: Add TLS/HTTPS support to hugo server

The "auto cert" handling in this PR is backed by mkcert (see link below).

To get this up and running on a new PC, you can:

```
hugo server trust
hugo server --tlsAuto
```

When `--tlsAuto` (or `--tlsCertFile` and `--tlsKeyFile`) is set and no `--baseURL` is provided as a flag, the server is
started with TLS and `https` as the protocol.

Note that you only need to run `hugo server trust` once per PC.

If you already have the key and the cert file (e.g. by using mkcert directly), you can do:

```
hugo server --tlsCertFile mycert.pem --tlsKeyFile mykey.pem
```

See https://github.com/FiloSottile/mkcert

Fixes #11064
commands/commandeer.go
commands/server.go
go.mod
go.sum
testscripts/commands/gen.txt