Ejemplo n.º 1
0
func getBucket(option *media_library.Option) string {
	if bucket := option.Get("bucket"); bucket != "" {
		return bucket
	}

	return Bucket
}
Ejemplo n.º 2
0
func (s S3) GetURLTemplate(option *media_library.Option) (path string) {
	if path = option.Get("URL"); path == "" {
		path = "/{{class}}/{{primary_key}}/{{column}}/{{filename_with_hash}}"
	}

	return "//" + getEndpoint(option) + path
}
Ejemplo n.º 3
0
func getEndpoint(option *media_library.Option) string {
	if endpoint := option.Get("endpoint"); endpoint != "" {
		return endpoint
	}

	return getBucket(option) + "." + *S3Client.Config.Endpoint
}
Ejemplo n.º 4
0
// GetURLTemplate get url template
func (s CloudFront) GetURLTemplate(option *media_library.Option) (path string) {
	if path = option.Get("URL"); path == "" {
		path = "/{{class}}/{{primary_key}}/{{column}}/{{filename_with_hash}}"
	}
	if awsCloudFontDomain != "" {
		return awsCloudFontDomain + path
	}
	return "//" + getEndpoint(option) + path

}
Ejemplo n.º 5
0
func getEndpoint(option *media_library.Option) string {
	if endpoint := option.Get("endpoint"); endpoint != "" {
		return endpoint
	}

	endpoint := s3client().Endpoint
	for _, prefix := range []string{"https://", "http://"} {
		endpoint = strings.TrimPrefix(endpoint, prefix)
	}

	return getBucket(option) + "." + endpoint
}
Ejemplo n.º 6
0
func getEndpoint(option *media_library.Option) string {
	if endpoint := option.Get("endpoint"); endpoint != "" {
		return endpoint
	}
	return EndPoint + "/@"
}
Ejemplo n.º 7
0
func getEndpoint(option *media_library.Option) string {
	if endpoint := option.Get("endpoint"); endpoint != "" {
		return endpoint
	}
	return getBucket(option) + "." + config.AliOSSRegion
}