diff options
Diffstat (limited to 'internal/config')
-rw-r--r-- | internal/config/config.go | 10 | ||||
-rw-r--r-- | internal/config/defaults.go | 10 | ||||
-rw-r--r-- | internal/config/helpers.gen.go | 50 |
3 files changed, 62 insertions, 8 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 5c59c47cc..33003d0f9 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -92,10 +92,12 @@ type Configuration struct { InstanceSubscriptionsProcessEvery time.Duration `name:"instance-subscriptions-process-every" usage:"Period to elapse between instance subscriptions processing jobs, starting from instance-subscriptions-process-from."` InstanceStatsMode string `name:"instance-stats-mode" usage:"Allows you to customize the way stats are served to crawlers: one of '', 'serve', 'zero', 'baffle'. Home page stats remain unchanged."` - AccountsRegistrationOpen bool `name:"accounts-registration-open" usage:"Allow anyone to submit an account signup request. If false, server will be invite-only."` - AccountsReasonRequired bool `name:"accounts-reason-required" usage:"Do new account signups require a reason to be submitted on registration?"` - 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."` + AccountsRegistrationOpen bool `name:"accounts-registration-open" usage:"Allow anyone to submit an account signup request. If false, server will be invite-only."` + AccountsReasonRequired bool `name:"accounts-reason-required" usage:"Do new account signups require a reason to be submitted on registration?"` + AccountsRegistrationDailyLimit int `name:"accounts-registration-daily-limit" usage:"Limit amount of approved account sign-ups allowed per 24hrs before registration is closed. 0 or less = no limit."` + AccountsRegistrationBacklogLimit int `name:"accounts-registration-backlog-limit" usage:"Limit how big the 'accounts pending approval' queue can grow before registration is closed. 0 or less = no limit."` + 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."` 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"` diff --git a/internal/config/defaults.go b/internal/config/defaults.go index 157dfde0a..7f66e4209 100644 --- a/internal/config/defaults.go +++ b/internal/config/defaults.go @@ -68,10 +68,12 @@ var Defaults = Configuration{ InstanceSubscriptionsProcessFrom: "23:00", // 11pm, InstanceSubscriptionsProcessEvery: 24 * time.Hour, // 1/day. - AccountsRegistrationOpen: false, - AccountsReasonRequired: true, - AccountsAllowCustomCSS: false, - AccountsCustomCSSLength: 10000, + AccountsRegistrationOpen: false, + AccountsReasonRequired: true, + AccountsRegistrationDailyLimit: 10, + AccountsRegistrationBacklogLimit: 20, + AccountsAllowCustomCSS: false, + AccountsCustomCSSLength: 10000, MediaDescriptionMinChars: 0, MediaDescriptionMaxChars: 1500, diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go index 54d1b62d9..d3ccf16ea 100644 --- a/internal/config/helpers.gen.go +++ b/internal/config/helpers.gen.go @@ -1132,6 +1132,56 @@ func GetAccountsReasonRequired() bool { return global.GetAccountsReasonRequired( // SetAccountsReasonRequired safely sets the value for global configuration 'AccountsReasonRequired' field func SetAccountsReasonRequired(v bool) { global.SetAccountsReasonRequired(v) } +// GetAccountsRegistrationDailyLimit safely fetches the Configuration value for state's 'AccountsRegistrationDailyLimit' field +func (st *ConfigState) GetAccountsRegistrationDailyLimit() (v int) { + st.mutex.RLock() + v = st.config.AccountsRegistrationDailyLimit + st.mutex.RUnlock() + return +} + +// SetAccountsRegistrationDailyLimit safely sets the Configuration value for state's 'AccountsRegistrationDailyLimit' field +func (st *ConfigState) SetAccountsRegistrationDailyLimit(v int) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.AccountsRegistrationDailyLimit = v + st.reloadToViper() +} + +// AccountsRegistrationDailyLimitFlag returns the flag name for the 'AccountsRegistrationDailyLimit' field +func AccountsRegistrationDailyLimitFlag() string { return "accounts-registration-daily-limit" } + +// GetAccountsRegistrationDailyLimit safely fetches the value for global configuration 'AccountsRegistrationDailyLimit' field +func GetAccountsRegistrationDailyLimit() int { return global.GetAccountsRegistrationDailyLimit() } + +// SetAccountsRegistrationDailyLimit safely sets the value for global configuration 'AccountsRegistrationDailyLimit' field +func SetAccountsRegistrationDailyLimit(v int) { global.SetAccountsRegistrationDailyLimit(v) } + +// GetAccountsRegistrationBacklogLimit safely fetches the Configuration value for state's 'AccountsRegistrationBacklogLimit' field +func (st *ConfigState) GetAccountsRegistrationBacklogLimit() (v int) { + st.mutex.RLock() + v = st.config.AccountsRegistrationBacklogLimit + st.mutex.RUnlock() + return +} + +// SetAccountsRegistrationBacklogLimit safely sets the Configuration value for state's 'AccountsRegistrationBacklogLimit' field +func (st *ConfigState) SetAccountsRegistrationBacklogLimit(v int) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.AccountsRegistrationBacklogLimit = v + st.reloadToViper() +} + +// AccountsRegistrationBacklogLimitFlag returns the flag name for the 'AccountsRegistrationBacklogLimit' field +func AccountsRegistrationBacklogLimitFlag() string { return "accounts-registration-backlog-limit" } + +// GetAccountsRegistrationBacklogLimit safely fetches the value for global configuration 'AccountsRegistrationBacklogLimit' field +func GetAccountsRegistrationBacklogLimit() int { return global.GetAccountsRegistrationBacklogLimit() } + +// SetAccountsRegistrationBacklogLimit safely sets the value for global configuration 'AccountsRegistrationBacklogLimit' field +func SetAccountsRegistrationBacklogLimit(v int) { global.SetAccountsRegistrationBacklogLimit(v) } + // GetAccountsAllowCustomCSS safely fetches the Configuration value for state's 'AccountsAllowCustomCSS' field func (st *ConfigState) GetAccountsAllowCustomCSS() (v bool) { st.mutex.RLock() |