aliyunoss

package module
v0.0.0-...-8a747b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

Aliyun OSS Storage (preview)

This plugin can be used to store attachments and avatars to Aliyun OSS.

How to use

Build
./answer build --with github.com/answerdev/plugins/storage/aliyunoss
Configuration
  • Endpoint - Endpoint of AliCloud OSS storage, such as oss-cn-hangzhou.aliyuncs.com
  • Bucket Name - Your bucket name
  • Object Key Prefix - Prefix of the object key like 'answer/data/' that ending with '/'
  • Access Key Id - AccessKeyID of the AliCloud OSS storage
  • Access Key Secret - AccessKeySecret of the AliCloud OSS storage
  • Visit Url Prefix - Prefix of access address for the uploaded file, ending with '/' such as https://example.com/xxx/
  • Max File Size - Max file size in MB, default is 10MB

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage struct {
	Config *StorageConfig
}

func (*Storage) CheckFileType

func (s *Storage) CheckFileType(originalFilename string, source plugin.UploadSource) bool

func (*Storage) ConfigFields

func (s *Storage) ConfigFields() []plugin.ConfigField

func (*Storage) ConfigReceiver

func (s *Storage) ConfigReceiver(config []byte) error

func (*Storage) Info

func (s *Storage) Info() plugin.Info

func (*Storage) UploadFile

func (s *Storage) UploadFile(ctx *plugin.GinContext, source plugin.UploadSource) (resp plugin.UploadFileResponse)

type StorageConfig

type StorageConfig struct {
	Endpoint        string `json:"endpoint"`
	BucketName      string `json:"bucket_name"`
	ObjectKeyPrefix string `json:"object_key_prefix"`
	AccessKeyID     string `json:"access_key_id"`
	AccessKeySecret string `json:"access_key_secret"`
	VisitUrlPrefix  string `json:"visit_url_prefix"`
	MaxFileSize     string `json:"max_file_size"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL