photoprism/internal/config/config_proxy.go
Michael Mayer 6dd55170fe Config: Add option to set a proxy for outgoing connections #3132
Signed-off-by: Michael Mayer <michael@photoprism.app>
2023-01-19 20:46:27 +01:00

25 lines
559 B
Go

package config
import (
"os"
)
// HttpsProxy returns the HTTPS proxy to use for outgoing connections.
func (c *Config) HttpsProxy() string {
if c.options.HttpsProxy != "" {
return c.options.HttpsProxy
} else if httpsProxy := os.Getenv("HTTPS_PROXY"); httpsProxy != "" {
return httpsProxy
}
return ""
}
// HttpsProxyInsecure checks if invalid TLS certificates should be ignored when using the configured HTTPS proxy.
func (c *Config) HttpsProxyInsecure() bool {
if c.HttpsProxy() == "" {
return false
}
return c.options.HttpsProxyInsecure
}