refactor(code): Cleaned-up the code base
This commit is contained in:
100
lib/config/models.go
Normal file
100
lib/config/models.go
Normal file
@@ -0,0 +1,100 @@
|
||||
package config
|
||||
|
||||
type Source string
|
||||
|
||||
const (
|
||||
SourceDefault Source = "default"
|
||||
SourceEnv Source = "environment"
|
||||
SourceDB Source = "db override"
|
||||
)
|
||||
|
||||
type AdminEnabledMode string
|
||||
|
||||
const (
|
||||
AdminEnabledAuto AdminEnabledMode = "auto"
|
||||
AdminEnabledTrue AdminEnabledMode = "true"
|
||||
AdminEnabledFalse AdminEnabledMode = "false"
|
||||
)
|
||||
|
||||
const (
|
||||
SettingGuestUploadsEnabled = "guest_uploads_enabled"
|
||||
SettingAPIEnabled = "api_enabled"
|
||||
SettingZipDownloadsEnabled = "zip_downloads_enabled"
|
||||
SettingOneTimeDownloadsEnabled = "one_time_downloads_enabled"
|
||||
SettingOneTimeDownloadExpirySecs = "one_time_download_expiry_seconds"
|
||||
SettingOneTimeDownloadRetryFail = "one_time_download_retry_on_failure"
|
||||
SettingRenewOnAccessEnabled = "renew_on_access_enabled"
|
||||
SettingRenewOnDownloadEnabled = "renew_on_download_enabled"
|
||||
SettingDefaultGuestExpirySecs = "default_guest_expiry_seconds"
|
||||
SettingMaxGuestExpirySecs = "max_guest_expiry_seconds"
|
||||
SettingGlobalMaxFileSizeBytes = "global_max_file_size_bytes"
|
||||
SettingGlobalMaxBoxSizeBytes = "global_max_box_size_bytes"
|
||||
SettingDefaultUserMaxFileBytes = "default_user_max_file_size_bytes"
|
||||
SettingDefaultUserMaxBoxBytes = "default_user_max_box_size_bytes"
|
||||
SettingSessionTTLSeconds = "session_ttl_seconds"
|
||||
SettingBoxPollIntervalMS = "box_poll_interval_ms"
|
||||
SettingThumbnailBatchSize = "thumbnail_batch_size"
|
||||
SettingThumbnailIntervalSeconds = "thumbnail_interval_seconds"
|
||||
SettingDataDir = "data_dir"
|
||||
)
|
||||
|
||||
type SettingType string
|
||||
|
||||
const (
|
||||
SettingTypeBool SettingType = "bool"
|
||||
SettingTypeInt64 SettingType = "int64"
|
||||
SettingTypeInt SettingType = "int"
|
||||
SettingTypeText SettingType = "text"
|
||||
)
|
||||
|
||||
type SettingDefinition struct {
|
||||
Key string
|
||||
EnvName string
|
||||
Label string
|
||||
Type SettingType
|
||||
Editable bool
|
||||
HardLimit bool
|
||||
Minimum int64
|
||||
}
|
||||
|
||||
type SettingRow struct {
|
||||
Definition SettingDefinition
|
||||
Value string
|
||||
Source Source
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
DataDir string
|
||||
UploadsDir string
|
||||
DBDir string
|
||||
|
||||
AdminPassword string
|
||||
AdminUsername string
|
||||
AdminEmail string
|
||||
AdminEnabled AdminEnabledMode
|
||||
AdminCookieSecure bool
|
||||
AllowAdminSettingsOverride bool
|
||||
|
||||
GuestUploadsEnabled bool
|
||||
APIEnabled bool
|
||||
ZipDownloadsEnabled bool
|
||||
OneTimeDownloadsEnabled bool
|
||||
OneTimeDownloadExpirySeconds int64
|
||||
OneTimeDownloadRetryOnFailure bool
|
||||
RenewOnAccessEnabled bool
|
||||
RenewOnDownloadEnabled bool
|
||||
|
||||
DefaultGuestExpirySeconds int64
|
||||
MaxGuestExpirySeconds int64
|
||||
GlobalMaxFileSizeBytes int64
|
||||
GlobalMaxBoxSizeBytes int64
|
||||
DefaultUserMaxFileSizeBytes int64
|
||||
DefaultUserMaxBoxSizeBytes int64
|
||||
SessionTTLSeconds int64
|
||||
BoxPollIntervalMS int
|
||||
ThumbnailBatchSize int
|
||||
ThumbnailIntervalSeconds int
|
||||
|
||||
sources map[string]Source
|
||||
values map[string]string
|
||||
}
|
||||
Reference in New Issue
Block a user