mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Database backed LetsEncrypt certificate cache (#993)
This commit is contained in:
parent
4464802947
commit
0bece2df7d
8 changed files with 78 additions and 57 deletions
|
@ -409,41 +409,6 @@ func TestDefaultCertDomainValue(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestCertCache(t *testing.T) {
|
||||
os.Clearenv()
|
||||
os.Setenv("CERT_CACHE", "foobar")
|
||||
|
||||
parser := NewParser()
|
||||
opts, err := parser.ParseEnvironmentVariables()
|
||||
if err != nil {
|
||||
t.Fatalf(`Parsing failure: %v`, err)
|
||||
}
|
||||
|
||||
expected := "foobar"
|
||||
result := opts.CertCache()
|
||||
|
||||
if result != expected {
|
||||
t.Fatalf(`Unexpected CERT_CACHE value, got %q instead of %q`, result, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultCertCacheValue(t *testing.T) {
|
||||
os.Clearenv()
|
||||
|
||||
parser := NewParser()
|
||||
opts, err := parser.ParseEnvironmentVariables()
|
||||
if err != nil {
|
||||
t.Fatalf(`Parsing failure: %v`, err)
|
||||
}
|
||||
|
||||
expected := defaultCertCache
|
||||
result := opts.CertCache()
|
||||
|
||||
if result != expected {
|
||||
t.Fatalf(`Unexpected CERT_CACHE value, got %q instead of %q`, result, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultCleanupFrequencyHoursValue(t *testing.T) {
|
||||
os.Clearenv()
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ const (
|
|||
defaultCertFile = ""
|
||||
defaultKeyFile = ""
|
||||
defaultCertDomain = ""
|
||||
defaultCertCache = "/tmp/cert_cache"
|
||||
defaultCleanupFrequencyHours = 24
|
||||
defaultCleanupArchiveReadDays = 60
|
||||
defaultCleanupArchiveUnreadDays = 180
|
||||
|
@ -93,7 +92,6 @@ type Options struct {
|
|||
listenAddr string
|
||||
certFile string
|
||||
certDomain string
|
||||
certCache string
|
||||
certKeyFile string
|
||||
cleanupFrequencyHours int
|
||||
cleanupArchiveReadDays int
|
||||
|
@ -150,7 +148,6 @@ func NewOptions() *Options {
|
|||
listenAddr: defaultListenAddr,
|
||||
certFile: defaultCertFile,
|
||||
certDomain: defaultCertDomain,
|
||||
certCache: defaultCertCache,
|
||||
certKeyFile: defaultKeyFile,
|
||||
cleanupFrequencyHours: defaultCleanupFrequencyHours,
|
||||
cleanupArchiveReadDays: defaultCleanupArchiveReadDays,
|
||||
|
@ -266,11 +263,6 @@ func (o *Options) CertDomain() string {
|
|||
return o.certDomain
|
||||
}
|
||||
|
||||
// CertCache returns the directory to use for Let's Encrypt session cache.
|
||||
func (o *Options) CertCache() string {
|
||||
return o.certCache
|
||||
}
|
||||
|
||||
// CleanupFrequencyHours returns the interval in hours for cleanup jobs.
|
||||
func (o *Options) CleanupFrequencyHours() int {
|
||||
return o.cleanupFrequencyHours
|
||||
|
@ -466,7 +458,6 @@ func (o *Options) SortedOptions() []*Option {
|
|||
"BASE_PATH": o.basePath,
|
||||
"BASE_URL": o.baseURL,
|
||||
"BATCH_SIZE": o.batchSize,
|
||||
"CERT_CACHE": o.certCache,
|
||||
"CERT_DOMAIN": o.certDomain,
|
||||
"CERT_FILE": o.certFile,
|
||||
"CLEANUP_ARCHIVE_READ_DAYS": o.cleanupArchiveReadDays,
|
||||
|
|
|
@ -112,8 +112,6 @@ func (p *Parser) parseLines(lines []string) (err error) {
|
|||
p.opts.certKeyFile = parseString(value, defaultKeyFile)
|
||||
case "CERT_DOMAIN":
|
||||
p.opts.certDomain = parseString(value, defaultCertDomain)
|
||||
case "CERT_CACHE":
|
||||
p.opts.certCache = parseString(value, defaultCertCache)
|
||||
case "CLEANUP_FREQUENCY_HOURS":
|
||||
p.opts.cleanupFrequencyHours = parseInt(value, defaultCleanupFrequencyHours)
|
||||
case "CLEANUP_ARCHIVE_READ_DAYS":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue