@ -10,40 +10,40 @@ import (
)
)
const (
const (
defaultHTTPS = false
defaultHTTPS = false
defaultLogDateTime = false
defaultLogDateTime = false
defaultHSTS = true
defaultHSTS = true
defaultHTTPService = true
defaultHTTPService = true
defaultSchedulerService = true
defaultSchedulerService = true
defaultDebug = false
defaultDebug = false
defaultBaseURL = "http://localhost"
defaultBaseURL = "http://localhost"
defaultRootURL = "http://localhost"
defaultRootURL = "http://localhost"
defaultBasePath = ""
defaultBasePath = ""
defaultWorkerPoolSize = 5
defaultWorkerPoolSize = 5
defaultPollingFrequency = 60
defaultPollingFrequency = 60
defaultBatchSize = 10
defaultBatchSize = 10
defaultRunMigrations = false
defaultRunMigrations = false
defaultDatabaseURL = "user=postgres password=postgres dbname=miniflux2 sslmode=disable"
defaultDatabaseURL = "user=postgres password=postgres dbname=miniflux2 sslmode=disable"
defaultDatabaseMaxConns = 20
defaultDatabaseMaxConns = 20
defaultDatabaseMinConns = 1
defaultDatabaseMinConns = 1
defaultArchiveReadDays = 60
defaultListenAddr = "127.0.0.1:8080"
defaultRemoveSessionsDays = 30
defaultCertFile = ""
defaultListenAddr = "127.0.0.1:8080 "
defaultKeyFile = ""
defaultCertFile = ""
defaultCertDomain = ""
defaultKeyFile = ""
defaultCertCache = "/tmp/cert_cache "
defaultCertDomain = ""
defaultCleanupFrequencyHours = 24
defaultCertCache = "/tmp/cert_cache"
defaultCleanupArchiveReadDays = 60
defaultCleanupFrequency = 24
defaultCleanupRemoveSessionsDays = 30
defaultProxyImages = "http-only"
defaultProxyImages = "http-only"
defaultCreateAdmin = false
defaultCreateAdmin = false
defaultOAuth2UserCreation = false
defaultOAuth2UserCreation = false
defaultOAuth2ClientID = ""
defaultOAuth2ClientID = ""
defaultOAuth2ClientSecret = ""
defaultOAuth2ClientSecret = ""
defaultOAuth2RedirectURL = ""
defaultOAuth2RedirectURL = ""
defaultOAuth2Provider = ""
defaultOAuth2Provider = ""
defaultPocketConsumerKey = ""
defaultPocketConsumerKey = ""
defaultHTTPClientTimeout = 20
defaultHTTPClientTimeout = 20
defaultHTTPClientMaxBodySize = 15
defaultHTTPClientMaxBodySize = 15
)
)
// Options contains configuration options.
// Options contains configuration options.
@ -66,9 +66,9 @@ type Options struct {
certDomain string
certDomain string
certCache string
certCache string
certKeyFile string
certKeyFile string
cleanupFrequency int
cleanupFrequencyHours int
archiveReadDays int
cle anupA rchiveReadDays int
removeSessionsDays int
cleanupRemoveSessionsDays int
pollingFrequency int
pollingFrequency int
batchSize int
batchSize int
workerPoolSize int
workerPoolSize int
@ -105,9 +105,9 @@ func NewOptions() *Options {
certDomain : defaultCertDomain ,
certDomain : defaultCertDomain ,
certCache : defaultCertCache ,
certCache : defaultCertCache ,
certKeyFile : defaultKeyFile ,
certKeyFile : defaultKeyFile ,
cleanupFrequency : defaultCleanupFrequency ,
cleanupFrequencyHours : defaultCleanupFrequencyHours ,
archiveReadDays : defaultArchiveReadDays ,
cle anupA rchiveReadDays: defaultCleanup ArchiveReadDays ,
removeSessionsDays : default RemoveSessionsDays,
cleanupRemoveSessionsDays : defaultCleanup RemoveSessionsDays,
pollingFrequency : defaultPollingFrequency ,
pollingFrequency : defaultPollingFrequency ,
batchSize : defaultBatchSize ,
batchSize : defaultBatchSize ,
workerPoolSize : defaultWorkerPoolSize ,
workerPoolSize : defaultWorkerPoolSize ,
@ -194,9 +194,19 @@ func (o *Options) CertCache() string {
return o . certCache
return o . certCache
}
}
// CleanupFrequency returns the interval for cleanup jobs.
// CleanupFrequencyHours returns the interval in hours for cleanup jobs.
func ( o * Options ) CleanupFrequency ( ) int {
func ( o * Options ) CleanupFrequencyHours ( ) int {
return o . cleanupFrequency
return o . cleanupFrequencyHours
}
// CleanupArchiveReadDays returns the number of days after which marking read items as removed.
func ( o * Options ) CleanupArchiveReadDays ( ) int {
return o . cleanupArchiveReadDays
}
// CleanupRemoveSessionsDays returns the number of days after which to remove sessions.
func ( o * Options ) CleanupRemoveSessionsDays ( ) int {
return o . cleanupRemoveSessionsDays
}
}
// WorkerPoolSize returns the number of background worker.
// WorkerPoolSize returns the number of background worker.
@ -269,16 +279,6 @@ func (o *Options) HasSchedulerService() bool {
return o . schedulerService
return o . schedulerService
}
}
// ArchiveReadDays returns the number of days after which marking read items as removed.
func ( o * Options ) ArchiveReadDays ( ) int {
return o . archiveReadDays
}
// RemoveSessionsDays returns the number of days after which to remove sessions.
func ( o * Options ) RemoveSessionsDays ( ) int {
return o . removeSessionsDays
}
// PocketConsumerKey returns the Pocket Consumer Key if configured.
// PocketConsumerKey returns the Pocket Consumer Key if configured.
func ( o * Options ) PocketConsumerKey ( defaultValue string ) string {
func ( o * Options ) PocketConsumerKey ( defaultValue string ) string {
if o . pocketConsumerKey != "" {
if o . pocketConsumerKey != "" {
@ -317,11 +317,12 @@ func (o *Options) String() string {
builder . WriteString ( fmt . Sprintf ( "KEY_FILE: %v\n" , o . certKeyFile ) )
builder . WriteString ( fmt . Sprintf ( "KEY_FILE: %v\n" , o . certKeyFile ) )
builder . WriteString ( fmt . Sprintf ( "CERT_DOMAIN: %v\n" , o . certDomain ) )
builder . WriteString ( fmt . Sprintf ( "CERT_DOMAIN: %v\n" , o . certDomain ) )
builder . WriteString ( fmt . Sprintf ( "CERT_CACHE: %v\n" , o . certCache ) )
builder . WriteString ( fmt . Sprintf ( "CERT_CACHE: %v\n" , o . certCache ) )
builder . WriteString ( fmt . Sprintf ( "CLEANUP_FREQUENCY: %v\n" , o . cleanupFrequency ) )
builder . WriteString ( fmt . Sprintf ( "CLEANUP_FREQUENCY_HOURS: %v\n" , o . cleanupFrequencyHours ) )
builder . WriteString ( fmt . Sprintf ( "CLEANUP_ARCHIVE_READ_DAYS: %v\n" , o . cleanupArchiveReadDays ) )
builder . WriteString ( fmt . Sprintf ( "CLEANUP_REMOVE_SESSIONS_DAYS: %v\n" , o . cleanupRemoveSessionsDays ) )
builder . WriteString ( fmt . Sprintf ( "WORKER_POOL_SIZE: %v\n" , o . workerPoolSize ) )
builder . WriteString ( fmt . Sprintf ( "WORKER_POOL_SIZE: %v\n" , o . workerPoolSize ) )
builder . WriteString ( fmt . Sprintf ( "POLLING_FREQUENCY: %v\n" , o . pollingFrequency ) )
builder . WriteString ( fmt . Sprintf ( "POLLING_FREQUENCY: %v\n" , o . pollingFrequency ) )
builder . WriteString ( fmt . Sprintf ( "BATCH_SIZE: %v\n" , o . batchSize ) )
builder . WriteString ( fmt . Sprintf ( "BATCH_SIZE: %v\n" , o . batchSize ) )
builder . WriteString ( fmt . Sprintf ( "ARCHIVE_READ_DAYS: %v\n" , o . archiveReadDays ) )
builder . WriteString ( fmt . Sprintf ( "PROXY_IMAGES: %v\n" , o . proxyImages ) )
builder . WriteString ( fmt . Sprintf ( "PROXY_IMAGES: %v\n" , o . proxyImages ) )
builder . WriteString ( fmt . Sprintf ( "CREATE_ADMIN: %v\n" , o . createAdmin ) )
builder . WriteString ( fmt . Sprintf ( "CREATE_ADMIN: %v\n" , o . createAdmin ) )
builder . WriteString ( fmt . Sprintf ( "POCKET_CONSUMER_KEY: %v\n" , o . pocketConsumerKey ) )
builder . WriteString ( fmt . Sprintf ( "POCKET_CONSUMER_KEY: %v\n" , o . pocketConsumerKey ) )