More fixes

This commit is contained in:
James Mills
2021-01-30 15:26:24 +10:00
parent 401f635b3b
commit 8495ba0319
8 changed files with 15 additions and 304 deletions

View File

@@ -2,7 +2,6 @@ package internal
import (
"net/url"
"regexp"
"time"
)
@@ -174,14 +173,6 @@ func WithAdminEmail(adminEmail string) Option {
}
}
// WithFeedSources sets the feed sources to use for external feeds
func WithFeedSources(feedSources []string) Option {
return func(cfg *Config) error {
cfg.FeedSources = feedSources
return nil
}
}
// WithName sets the instance's name
func WithName(name string) Option {
return func(cfg *Config) error {
@@ -206,14 +197,6 @@ func WithTheme(theme string) Option {
}
}
// WithOpenRegistrations sets the open registrations flag
func WithOpenRegistrations(openRegistrations bool) Option {
return func(cfg *Config) error {
cfg.OpenRegistrations = openRegistrations
return nil
}
}
// WithCookieSecret sets the server's cookie secret
func WithCookieSecret(secret string) Option {
return func(cfg *Config) error {
@@ -246,14 +229,6 @@ func WithSessionExpiry(expiry time.Duration) Option {
}
}
// WithTranscoderTimeout sets the video transcoding timeout
func WithTranscoderTimeout(timeout time.Duration) Option {
return func(cfg *Config) error {
cfg.TranscoderTimeout = timeout
return nil
}
}
// WithMagicLinkSecret sets the MagicLinkSecert used to create password reset tokens
func WithMagicLinkSecret(secret string) Option {
return func(cfg *Config) error {
@@ -262,22 +237,6 @@ func WithMagicLinkSecret(secret string) Option {
}
}
// WithSMTPBind sets the interface and port to bind to for SMTP
func WithSMTPBind(smtpBind string) Option {
return func(cfg *Config) error {
cfg.SMTPBind = smtpBind
return nil
}
}
// WithPOP3Bind sets the interface and port to use for POP3
func WithPOP3Bind(pop3Bind string) Option {
return func(cfg *Config) error {
cfg.POP3Bind = pop3Bind
return nil
}
}
// WithSMTPHost sets the SMTPHost to use for sending email
func WithSMTPHost(host string) Option {
return func(cfg *Config) error {
@@ -318,14 +277,6 @@ func WithSMTPFrom(from string) Option {
}
}
// WithMaxFetchLimit sets the maximum feed fetch limit in bytes
func WithMaxFetchLimit(limit int64) Option {
return func(cfg *Config) error {
cfg.MaxFetchLimit = limit
return nil
}
}
// WithAPISessionTime sets the API session time for tokens
func WithAPISessionTime(duration time.Duration) Option {
return func(cfg *Config) error {
@@ -341,17 +292,3 @@ func WithAPISigningKey(key string) Option {
return nil
}
}
// WithWhitelistedDomains sets the list of domains whitelisted and permitted for external iamges
func WithWhitelistedDomains(whitelistedDomains []string) Option {
return func(cfg *Config) error {
for _, whitelistedDomain := range whitelistedDomains {
re, err := regexp.Compile(whitelistedDomain)
if err != nil {
return err
}
cfg.whitelistedDomains = append(cfg.whitelistedDomains, re)
}
return nil
}
}