1
0
mirror of https://github.com/mxpv/podsync.git synced 2024-05-11 05:55:04 +00:00

Add TLS support

This commit is contained in:
Adam Curtis
2023-10-06 10:03:38 -04:00
parent cffd0020f4
commit 3aee543fe0
3 changed files with 15 additions and 1 deletions

View File

@ -237,7 +237,11 @@ func main() {
group.Go(func() error {
log.Infof("running listener at %s", srv.Addr)
return srv.ListenAndServe()
if cfg.Server.TLS {
return srv.ListenAndServeTLS(cfg.Server.CertificatePath, cfg.Server.KeyFilePath)
} else {
return srv.ListenAndServe()
}
})
group.Go(func() error {

View File

@ -11,6 +11,10 @@ hostname = "https://my.test.host:4443"
bind_address = "172.20.10.2"
# Specify path for reverse proxy and only [A-Za-z0-9]
path = "test"
# Optional. If you want to use TLS you must set the TLS flag and path to the certificate file and private key file.
tls = true
certificate_path = "/var/www/cert.pem"
key_file_path = "/var/www/priv.pem"
# Configure where to store the episode data
[storage]

View File

@ -20,6 +20,12 @@ type Config struct {
// "*": bind all IP addresses which is default option
// localhost or 127.0.0.1 bind a single IPv4 address
BindAddress string `toml:"bind_address"`
// Flag indicating if the server will use TLS
TLS bool `toml:"tls"`
// Path to a certificate file for TLS connections
CertificatePath string `toml:"certificate_path"`
// Path to a private key file for TLS connections
KeyFilePath string `toml:"key_file_path"`
// Specify path for reverse proxy and only [A-Za-z0-9]
Path string `toml:"path"`
// DataDir is a path to a directory to keep XML feeds and downloaded episodes,