Documentation ¶
Index ¶
Constants ¶
View Source
const ( // MinPartSize is the minimally supported part size for an S3 multi-part upload part. MinPartSize size = 5 << 20 // 5MiB // DefaultPartSize is the default size of the chunks used for Multi-part Upload if not provided by the configuration DefaultPartSize size = 16 << 20 // 16MiB // DefaultMaxUploadSize is the maximum upload size if not provided by the configuration DefaultMaxUploadSize size = 1 << 40 // 1TiB // DefaultRegion is the default S3 region if not provided by the configuration DefaultRegion = "us-east-1" // DefaultBucket is the default S3 bucket name to use if not provided by the configuration DefaultBucket = "gose-uploads" )
Variables ¶
View Source
var ( // DefaultExpiration is list of default expiration classes DefaultExpiration = []Expiration{ { ID: "1day", Title: "1day", Days: 1, }, { ID: "1week", Title: "1 week", Days: 7, }, { ID: "1month", Title: "1 month", Days: 31, }, { ID: "1year", Title: "1 year", Days: 365, }, } )
Functions ¶
func ParseFlags ¶
ParseFlags will create and parse the CLI flags and return the path to be used elsewhere
Types ¶
type Config ¶
type Config struct { *viper.Viper `json:"-" yaml:"-"` // Default or single server config values S3Server `json:",squash" yaml:"default"` // Multiple server config values Servers []S3Server `json:"servers" yaml:"servers,omitempty"` // Host is the local machine IP Address to bind the HTTP Server to Listen string `json:"listen" yaml:"listen,omitempty"` // Directory of frontend assets if not bundled Static string `json:"static" yaml:"static,omitempty"` // BaseURL at which Gose is accessible BaseURL string `json:"base_url" yaml:"base_url,omitempty"` Shortener *ShortenerConfig `json:"shortener" yaml:"shortener,omitempty"` Notification *NotificationConfig `json:"notification" yaml:"notification,omitempty"` }
Config contains the main configuration
type Expiration ¶ added in v0.2.0
type Expiration struct { ID string `json:"id" yaml:"id"` Title string `json:"title" yaml:"title"` Days int64 `json:"days" yaml:"days"` }
Expiration describes how long files are kept before getting deleted
type NotificationConfig ¶
type NotificationConfig struct { URLs []string `json:"urls" yaml:"urls"` Template string `json:"template" yaml:"template"` Uploads bool `json:"uploads" yaml:"uploads"` Downloads bool `json:"downloads" yaml:"downloads"` Mail *struct { URL string `json:"url" yaml:"url"` Template string `json:"template" yaml:"template"` } `json:"mail" yaml:"mail"` }
NotificationConfig contains notification specific configuration
type S3Server ¶ added in v0.2.0
type S3Server struct { // S3ServerConfig is the public info about an S3 server shared with the frontend S3ServerConfig `json:",squash"` Endpoint string `json:"endpoint" yaml:"endpoint"` Bucket string `json:"bucket" yaml:"bucket"` Region string `json:"region" yaml:"region"` PathStyle bool `json:"path_style" yaml:"path_style"` NoSSL bool `json:"no_ssl" yaml:"no_ssl"` AccessKey string `json:"access_key" yaml:"access_key"` SecretKey string `json:"secret_key" yaml:"secret_key"` Setup S3ServerSetup `json:"setup" yaml:"setup"` }
S3Server describes an S3 server
type S3ServerConfig ¶ added in v0.2.0
type S3ServerConfig struct { ID string `json:"id" yaml:"id"` Title string `json:"title" yaml:"title"` Implementation string `json:"implementation" yaml:"implementation"` MaxUploadSize size `json:"max_upload_size" yaml:"max_upload_size"` PartSize size `json:"part_size" yaml:"part_size"` Expiration []Expiration `json:"expiration" yaml:"expiration"` }
S3ServerConfig is the public part of S3Server
type S3ServerSetup ¶ added in v0.6.0
type S3ServerSetup struct { Bucket bool `json:"bucket" yaml:"bucket"` CORS bool `json:"cors" yaml:"cors"` Lifecycle bool `json:"lifecycle" yaml:"ifecycle"` AbortIncompleteUploads int `json:"abort_incomplete_uploads" yaml:"abort_incomplete_uploads"` }
S3ServerSetup describes initial configuration for an S3 server/bucket
type ShortenerConfig ¶
type ShortenerConfig struct { Endpoint string `json:"endpoint" yaml:"endpoint"` Method string `json:"method" yaml:"method"` Response string `json:"response" yaml:"response"` }
ShortenerConfig contains Link-shortener specific configuration
Click to show internal directories.
Click to hide internal directories.