Remove unnecessary storage config variables (#344)

* rewire config to not use extraneous serve vars

* rename 'file' to 'local' for consistency

* use Type and Size again
This commit is contained in:
tobi 2021-12-20 15:19:53 +01:00 committed by GitHub
commit cb8688f429
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 310 additions and 408 deletions

View file

@ -98,7 +98,7 @@ var Start action.GTSAction = func(ctx context.Context) error {
timelineManager := timelineprocessing.NewManager(dbService, typeConverter)
// Open the storage backend
storageBasePath := viper.GetString(config.Keys.StorageBasePath)
storageBasePath := viper.GetString(config.Keys.StorageLocalBasePath)
storage, err := kv.OpenFile(storageBasePath, nil)
if err != nil {
return fmt.Errorf("error creating storage backend: %s", err)

View file

@ -68,10 +68,7 @@ func Media(cmd *cobra.Command, values config.Values) {
// Storage attaches flags pertaining to storage config.
func Storage(cmd *cobra.Command, values config.Values) {
cmd.Flags().String(config.Keys.StorageBackend, values.StorageBackend, usage.StorageBackend)
cmd.Flags().String(config.Keys.StorageBasePath, values.StorageBasePath, usage.StorageBasePath)
cmd.Flags().String(config.Keys.StorageServeProtocol, values.StorageServeProtocol, usage.StorageServeProtocol)
cmd.Flags().String(config.Keys.StorageServeHost, values.StorageServeHost, usage.StorageServeHost)
cmd.Flags().String(config.Keys.StorageServeBasePath, values.StorageServeBasePath, usage.StorageServeBasePath)
cmd.Flags().String(config.Keys.StorageLocalBasePath, values.StorageLocalBasePath, usage.StorageLocalBasePath)
}
// Statuses attaches flags pertaining to statuses config.

View file

@ -48,10 +48,7 @@ var usage = config.KeyNames{
MediaDescriptionMinChars: "Min required chars for an image description",
MediaDescriptionMaxChars: "Max permitted chars for an image description",
StorageBackend: "Storage backend to use for media attachments",
StorageBasePath: "Full path to an already-created directory where gts should store/retrieve media files. Subfolders will be created within this dir.",
StorageServeProtocol: "Protocol to use for serving media attachments (use https if storage is local)",
StorageServeHost: "Hostname to serve media attachments from (use the same value as host if storage is local)",
StorageServeBasePath: "Path to append to protocol and hostname to create the base path from which media files will be served (default will mostly be fine)",
StorageLocalBasePath: "Full path to an already-created directory where gts should store/retrieve media files. Subfolders will be created within this dir.",
StatusesMaxChars: "Max permitted characters for posted statuses",
StatusesCWMaxChars: "Max permitted characters for content/spoiler warnings on statuses",
StatusesPollMaxOptions: "Max amount of options permitted on a poll",