diff options
Diffstat (limited to 'internal/config')
-rw-r--r-- | internal/config/config.go | 4 | ||||
-rw-r--r-- | internal/config/defaults.go | 4 | ||||
-rw-r--r-- | internal/config/flags.go | 4 | ||||
-rw-r--r-- | internal/config/helpers.gen.go | 100 |
4 files changed, 56 insertions, 56 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 015213184..bffa5b455 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -92,13 +92,13 @@ type Configuration struct { AccountsAllowCustomCSS bool `name:"accounts-allow-custom-css" usage:"Allow accounts to enable custom CSS for their profile pages and statuses."` AccountsCustomCSSLength int `name:"accounts-custom-css-length" usage:"Maximum permitted length (characters) of custom CSS for accounts."` - MediaImageMaxSize bytesize.Size `name:"media-image-max-size" usage:"Max size of accepted images in bytes"` - MediaVideoMaxSize bytesize.Size `name:"media-video-max-size" usage:"Max size of accepted videos in bytes"` MediaDescriptionMinChars int `name:"media-description-min-chars" usage:"Min required chars for an image description"` MediaDescriptionMaxChars int `name:"media-description-max-chars" usage:"Max permitted chars for an image description"` MediaRemoteCacheDays int `name:"media-remote-cache-days" usage:"Number of days to locally cache media from remote instances. If set to 0, remote media will be kept indefinitely."` MediaEmojiLocalMaxSize bytesize.Size `name:"media-emoji-local-max-size" usage:"Max size in bytes of emojis uploaded to this instance via the admin API."` MediaEmojiRemoteMaxSize bytesize.Size `name:"media-emoji-remote-max-size" usage:"Max size in bytes of emojis to download from other instances."` + MediaLocalMaxSize bytesize.Size `name:"media-local-max-size" usage:"Max size in bytes of media uploaded to this instance via API"` + MediaRemoteMaxSize bytesize.Size `name:"media-remote-max-size" usage:"Max size in bytes of media to download from other instances"` MediaCleanupFrom string `name:"media-cleanup-from" usage:"Time of day from which to start running media cleanup/prune jobs. Should be in the format 'hh:mm:ss', eg., '15:04:05'."` MediaCleanupEvery time.Duration `name:"media-cleanup-every" usage:"Period to elapse between cleanups, starting from media-cleanup-at."` diff --git a/internal/config/defaults.go b/internal/config/defaults.go index ba068761e..267e7b4bc 100644 --- a/internal/config/defaults.go +++ b/internal/config/defaults.go @@ -71,11 +71,11 @@ var Defaults = Configuration{ AccountsAllowCustomCSS: false, AccountsCustomCSSLength: 10000, - MediaImageMaxSize: 10 * bytesize.MiB, - MediaVideoMaxSize: 40 * bytesize.MiB, MediaDescriptionMinChars: 0, MediaDescriptionMaxChars: 1500, MediaRemoteCacheDays: 7, + MediaLocalMaxSize: 40 * bytesize.MiB, + MediaRemoteMaxSize: 40 * bytesize.MiB, MediaEmojiLocalMaxSize: 50 * bytesize.KiB, MediaEmojiRemoteMaxSize: 100 * bytesize.KiB, MediaCleanupFrom: "00:00", // Midnight. diff --git a/internal/config/flags.go b/internal/config/flags.go index 042621afe..f96709e70 100644 --- a/internal/config/flags.go +++ b/internal/config/flags.go @@ -97,11 +97,11 @@ func (s *ConfigState) AddServerFlags(cmd *cobra.Command) { cmd.Flags().Bool(AccountsAllowCustomCSSFlag(), cfg.AccountsAllowCustomCSS, fieldtag("AccountsAllowCustomCSS", "usage")) // Media - cmd.Flags().Uint64(MediaImageMaxSizeFlag(), uint64(cfg.MediaImageMaxSize), fieldtag("MediaImageMaxSize", "usage")) - cmd.Flags().Uint64(MediaVideoMaxSizeFlag(), uint64(cfg.MediaVideoMaxSize), fieldtag("MediaVideoMaxSize", "usage")) cmd.Flags().Int(MediaDescriptionMinCharsFlag(), cfg.MediaDescriptionMinChars, fieldtag("MediaDescriptionMinChars", "usage")) cmd.Flags().Int(MediaDescriptionMaxCharsFlag(), cfg.MediaDescriptionMaxChars, fieldtag("MediaDescriptionMaxChars", "usage")) cmd.Flags().Int(MediaRemoteCacheDaysFlag(), cfg.MediaRemoteCacheDays, fieldtag("MediaRemoteCacheDays", "usage")) + cmd.Flags().Uint64(MediaLocalMaxSizeFlag(), uint64(cfg.MediaLocalMaxSize), fieldtag("MediaLocalMaxSize", "usage")) + cmd.Flags().Uint64(MediaRemoteMaxSizeFlag(), uint64(cfg.MediaRemoteMaxSize), fieldtag("MediaRemoteMaxSize", "usage")) cmd.Flags().Uint64(MediaEmojiLocalMaxSizeFlag(), uint64(cfg.MediaEmojiLocalMaxSize), fieldtag("MediaEmojiLocalMaxSize", "usage")) cmd.Flags().Uint64(MediaEmojiRemoteMaxSizeFlag(), uint64(cfg.MediaEmojiRemoteMaxSize), fieldtag("MediaEmojiRemoteMaxSize", "usage")) cmd.Flags().String(MediaCleanupFromFlag(), cfg.MediaCleanupFrom, fieldtag("MediaCleanupFrom", "usage")) diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go index 8dab7ac6a..8c27da439 100644 --- a/internal/config/helpers.gen.go +++ b/internal/config/helpers.gen.go @@ -1075,56 +1075,6 @@ func GetAccountsCustomCSSLength() int { return global.GetAccountsCustomCSSLength // SetAccountsCustomCSSLength safely sets the value for global configuration 'AccountsCustomCSSLength' field func SetAccountsCustomCSSLength(v int) { global.SetAccountsCustomCSSLength(v) } -// GetMediaImageMaxSize safely fetches the Configuration value for state's 'MediaImageMaxSize' field -func (st *ConfigState) GetMediaImageMaxSize() (v bytesize.Size) { - st.mutex.RLock() - v = st.config.MediaImageMaxSize - st.mutex.RUnlock() - return -} - -// SetMediaImageMaxSize safely sets the Configuration value for state's 'MediaImageMaxSize' field -func (st *ConfigState) SetMediaImageMaxSize(v bytesize.Size) { - st.mutex.Lock() - defer st.mutex.Unlock() - st.config.MediaImageMaxSize = v - st.reloadToViper() -} - -// MediaImageMaxSizeFlag returns the flag name for the 'MediaImageMaxSize' field -func MediaImageMaxSizeFlag() string { return "media-image-max-size" } - -// GetMediaImageMaxSize safely fetches the value for global configuration 'MediaImageMaxSize' field -func GetMediaImageMaxSize() bytesize.Size { return global.GetMediaImageMaxSize() } - -// SetMediaImageMaxSize safely sets the value for global configuration 'MediaImageMaxSize' field -func SetMediaImageMaxSize(v bytesize.Size) { global.SetMediaImageMaxSize(v) } - -// GetMediaVideoMaxSize safely fetches the Configuration value for state's 'MediaVideoMaxSize' field -func (st *ConfigState) GetMediaVideoMaxSize() (v bytesize.Size) { - st.mutex.RLock() - v = st.config.MediaVideoMaxSize - st.mutex.RUnlock() - return -} - -// SetMediaVideoMaxSize safely sets the Configuration value for state's 'MediaVideoMaxSize' field -func (st *ConfigState) SetMediaVideoMaxSize(v bytesize.Size) { - st.mutex.Lock() - defer st.mutex.Unlock() - st.config.MediaVideoMaxSize = v - st.reloadToViper() -} - -// MediaVideoMaxSizeFlag returns the flag name for the 'MediaVideoMaxSize' field -func MediaVideoMaxSizeFlag() string { return "media-video-max-size" } - -// GetMediaVideoMaxSize safely fetches the value for global configuration 'MediaVideoMaxSize' field -func GetMediaVideoMaxSize() bytesize.Size { return global.GetMediaVideoMaxSize() } - -// SetMediaVideoMaxSize safely sets the value for global configuration 'MediaVideoMaxSize' field -func SetMediaVideoMaxSize(v bytesize.Size) { global.SetMediaVideoMaxSize(v) } - // GetMediaDescriptionMinChars safely fetches the Configuration value for state's 'MediaDescriptionMinChars' field func (st *ConfigState) GetMediaDescriptionMinChars() (v int) { st.mutex.RLock() @@ -1250,6 +1200,56 @@ func GetMediaEmojiRemoteMaxSize() bytesize.Size { return global.GetMediaEmojiRem // SetMediaEmojiRemoteMaxSize safely sets the value for global configuration 'MediaEmojiRemoteMaxSize' field func SetMediaEmojiRemoteMaxSize(v bytesize.Size) { global.SetMediaEmojiRemoteMaxSize(v) } +// GetMediaLocalMaxSize safely fetches the Configuration value for state's 'MediaLocalMaxSize' field +func (st *ConfigState) GetMediaLocalMaxSize() (v bytesize.Size) { + st.mutex.RLock() + v = st.config.MediaLocalMaxSize + st.mutex.RUnlock() + return +} + +// SetMediaLocalMaxSize safely sets the Configuration value for state's 'MediaLocalMaxSize' field +func (st *ConfigState) SetMediaLocalMaxSize(v bytesize.Size) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.MediaLocalMaxSize = v + st.reloadToViper() +} + +// MediaLocalMaxSizeFlag returns the flag name for the 'MediaLocalMaxSize' field +func MediaLocalMaxSizeFlag() string { return "media-local-max-size" } + +// GetMediaLocalMaxSize safely fetches the value for global configuration 'MediaLocalMaxSize' field +func GetMediaLocalMaxSize() bytesize.Size { return global.GetMediaLocalMaxSize() } + +// SetMediaLocalMaxSize safely sets the value for global configuration 'MediaLocalMaxSize' field +func SetMediaLocalMaxSize(v bytesize.Size) { global.SetMediaLocalMaxSize(v) } + +// GetMediaRemoteMaxSize safely fetches the Configuration value for state's 'MediaRemoteMaxSize' field +func (st *ConfigState) GetMediaRemoteMaxSize() (v bytesize.Size) { + st.mutex.RLock() + v = st.config.MediaRemoteMaxSize + st.mutex.RUnlock() + return +} + +// SetMediaRemoteMaxSize safely sets the Configuration value for state's 'MediaRemoteMaxSize' field +func (st *ConfigState) SetMediaRemoteMaxSize(v bytesize.Size) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.MediaRemoteMaxSize = v + st.reloadToViper() +} + +// MediaRemoteMaxSizeFlag returns the flag name for the 'MediaRemoteMaxSize' field +func MediaRemoteMaxSizeFlag() string { return "media-remote-max-size" } + +// GetMediaRemoteMaxSize safely fetches the value for global configuration 'MediaRemoteMaxSize' field +func GetMediaRemoteMaxSize() bytesize.Size { return global.GetMediaRemoteMaxSize() } + +// SetMediaRemoteMaxSize safely sets the value for global configuration 'MediaRemoteMaxSize' field +func SetMediaRemoteMaxSize(v bytesize.Size) { global.SetMediaRemoteMaxSize(v) } + // GetMediaCleanupFrom safely fetches the Configuration value for state's 'MediaCleanupFrom' field func (st *ConfigState) GetMediaCleanupFrom() (v string) { st.mutex.RLock() |