aliyunoss

package module
v0.0.0-...-2a39829 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

README

CDN With Aliyun OSS Storage (preview)

This plugin can be used to store static files to Aliyun OSS.

How to use

Build
./answer build --with github.com/apache/incubator-answer-plugins/cdn-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 'static/' 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 CDN file, ending with '/' such as https://static.example.com/xxx/
  • Max File Size - Max file size in MB, default is 10MB

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Info embed.FS

Functions

This section is empty.

Types

type CDN

type CDN struct {
	Config *CDNConfig
}

func (*CDN) CheckFileType

func (c *CDN) CheckFileType(filePath string) bool

func (*CDN) ConfigFields

func (c *CDN) ConfigFields() []plugin.ConfigField

func (*CDN) ConfigReceiver

func (c *CDN) ConfigReceiver(config []byte) error

func (*CDN) GetStaticPrefix

func (c *CDN) GetStaticPrefix() string

GetStaticPrefix get static prefix

func (*CDN) Info

func (c *CDN) Info() plugin.Info

func (*CDN) Upload

func (c *CDN) Upload(filePath string, file io.Reader, size int64) (err error)

type CDNConfig

type CDNConfig 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"`
}

type CustomFile

type CustomFile struct {
	// contains filtered or unexported fields
}

func (*CustomFile) Close

func (f *CustomFile) Close() error

func (*CustomFile) Read

func (f *CustomFile) Read(p []byte) (n int, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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