diff options
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/config/config.go | 12 | ||||
| -rw-r--r-- | internal/config/flags.go | 11 | ||||
| -rw-r--r-- | internal/config/helpers.gen.go | 50 | 
3 files changed, 68 insertions, 5 deletions
| diff --git a/internal/config/config.go b/internal/config/config.go index 612947c5e..5da226237 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -161,11 +161,13 @@ type Configuration struct {  	Cache CacheConfiguration `name:"cache"`  	// TODO: move these elsewhere, these are more ephemeral vs long-running flags like above -	AdminAccountUsername  string `name:"username" usage:"the username to create/delete/etc"` -	AdminAccountEmail     string `name:"email" usage:"the email address of this account"` -	AdminAccountPassword  string `name:"password" usage:"the password to set for this account"` -	AdminTransPath        string `name:"path" usage:"the path of the file to import from/export to"` -	AdminMediaPruneDryRun bool   `name:"dry-run" usage:"perform a dry run and only log number of items eligible for pruning"` +	AdminAccountUsername     string `name:"username" usage:"the username to create/delete/etc"` +	AdminAccountEmail        string `name:"email" usage:"the email address of this account"` +	AdminAccountPassword     string `name:"password" usage:"the password to set for this account"` +	AdminTransPath           string `name:"path" usage:"the path of the file to import from/export to"` +	AdminMediaPruneDryRun    bool   `name:"dry-run" usage:"perform a dry run and only log number of items eligible for pruning"` +	AdminMediaListLocalOnly  bool   `name:"local-only" usage:"list only local attachments/emojis; if specified then remote-only cannot also be true"` +	AdminMediaListRemoteOnly bool   `name:"remote-only" usage:"list only remote attachments/emojis; if specified then local-only cannot also be true"`  	RequestIDHeader string `name:"request-id-header" usage:"Header to extract the Request ID from. Eg.,'X-Request-Id'."`  } diff --git a/internal/config/flags.go b/internal/config/flags.go index ad07ec2ef..74ceedc00 100644 --- a/internal/config/flags.go +++ b/internal/config/flags.go @@ -203,6 +203,17 @@ func AddAdminTrans(cmd *cobra.Command) {  	}  } +// AddAdminMediaList attaches flags pertaining to media list commands. +func AddAdminMediaList(cmd *cobra.Command) { +	localOnly := AdminMediaListLocalOnlyFlag() +	localOnlyUsage := fieldtag("AdminMediaListLocalOnly", "usage") +	cmd.Flags().Bool(localOnly, false, localOnlyUsage) + +	remoteOnly := AdminMediaListRemoteOnlyFlag() +	remoteOnlyUsage := fieldtag("AdminMediaListRemoteOnly", "usage") +	cmd.Flags().Bool(remoteOnly, false, remoteOnlyUsage) +} +  // AddAdminMediaPrune attaches flags pertaining to media storage prune commands.  func AddAdminMediaPrune(cmd *cobra.Command) {  	name := AdminMediaPruneDryRunFlag() diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go index 801d4f667..a515da200 100644 --- a/internal/config/helpers.gen.go +++ b/internal/config/helpers.gen.go @@ -3374,6 +3374,56 @@ func GetAdminMediaPruneDryRun() bool { return global.GetAdminMediaPruneDryRun()  // SetAdminMediaPruneDryRun safely sets the value for global configuration 'AdminMediaPruneDryRun' field  func SetAdminMediaPruneDryRun(v bool) { global.SetAdminMediaPruneDryRun(v) } +// GetAdminMediaListLocalOnly safely fetches the Configuration value for state's 'AdminMediaListLocalOnly' field +func (st *ConfigState) GetAdminMediaListLocalOnly() (v bool) { +	st.mutex.RLock() +	v = st.config.AdminMediaListLocalOnly +	st.mutex.RUnlock() +	return +} + +// SetAdminMediaListLocalOnly safely sets the Configuration value for state's 'AdminMediaListLocalOnly' field +func (st *ConfigState) SetAdminMediaListLocalOnly(v bool) { +	st.mutex.Lock() +	defer st.mutex.Unlock() +	st.config.AdminMediaListLocalOnly = v +	st.reloadToViper() +} + +// AdminMediaListLocalOnlyFlag returns the flag name for the 'AdminMediaListLocalOnly' field +func AdminMediaListLocalOnlyFlag() string { return "local-only" } + +// GetAdminMediaListLocalOnly safely fetches the value for global configuration 'AdminMediaListLocalOnly' field +func GetAdminMediaListLocalOnly() bool { return global.GetAdminMediaListLocalOnly() } + +// SetAdminMediaListLocalOnly safely sets the value for global configuration 'AdminMediaListLocalOnly' field +func SetAdminMediaListLocalOnly(v bool) { global.SetAdminMediaListLocalOnly(v) } + +// GetAdminMediaListRemoteOnly safely fetches the Configuration value for state's 'AdminMediaListRemoteOnly' field +func (st *ConfigState) GetAdminMediaListRemoteOnly() (v bool) { +	st.mutex.RLock() +	v = st.config.AdminMediaListRemoteOnly +	st.mutex.RUnlock() +	return +} + +// SetAdminMediaListRemoteOnly safely sets the Configuration value for state's 'AdminMediaListRemoteOnly' field +func (st *ConfigState) SetAdminMediaListRemoteOnly(v bool) { +	st.mutex.Lock() +	defer st.mutex.Unlock() +	st.config.AdminMediaListRemoteOnly = v +	st.reloadToViper() +} + +// AdminMediaListRemoteOnlyFlag returns the flag name for the 'AdminMediaListRemoteOnly' field +func AdminMediaListRemoteOnlyFlag() string { return "remote-only" } + +// GetAdminMediaListRemoteOnly safely fetches the value for global configuration 'AdminMediaListRemoteOnly' field +func GetAdminMediaListRemoteOnly() bool { return global.GetAdminMediaListRemoteOnly() } + +// SetAdminMediaListRemoteOnly safely sets the value for global configuration 'AdminMediaListRemoteOnly' field +func SetAdminMediaListRemoteOnly(v bool) { global.SetAdminMediaListRemoteOnly(v) } +  // GetRequestIDHeader safely fetches the Configuration value for state's 'RequestIDHeader' field  func (st *ConfigState) GetRequestIDHeader() (v string) {  	st.mutex.RLock() | 
