storage/s3.go
func SafeCreateS3Bucket(domain, bucket, accessKey, secretKey string) (*S3Bucket, error) {
	s := &S3Bucket{
		Bucket:    bucket,
		Name:      "s3",
		Domain:    domain,
		AccessKey: accessKey,
		SecretKey: secretKey,
	}
	if s.Bucket == "" {
		return nil, errors.New("bucket name is undefined")
	}
	var k s3gof3r.Keys
	var err error

	if s.AccessKey == "" || s.SecretKey == "" {
		k, err = s3gof3r.EnvKeys() // get S3 keys from environment
		if err != nil {
			return nil, err
		}
	} else {
		k = s3gof3r.Keys{
			AccessKey: s.AccessKey,
			SecretKey: s.SecretKey,
		}
	}
	s3 := s3gof3r.New(s.Domain, k)
	s.bucket = s3.Bucket(s.Bucket)
	return s, nil
}
func SafeCreateS3Bucket(domain, bucket, accessKey, secretKey string) (*S3Bucket, error) {
	s := &S3Bucket{
		Bucket:    bucket,
		Name:      "s3",
		Domain:    domain,
		AccessKey: accessKey,
		SecretKey: secretKey,
	}
	if s.Bucket == "" {
		return nil, errors.New("bucket name is undefined")
	}
	var k s3gof3r.Keys
	var err error

	if s.AccessKey == "" || s.SecretKey == "" {
		k, err = s3gof3r.EnvKeys() // get S3 keys from environment
		if err != nil {
			return nil, err
		}
	} else {
		k = s3gof3r.Keys{
			AccessKey: s.AccessKey,
			SecretKey: s.SecretKey,
		}
	}
	s3 := s3gof3r.New(s.Domain, k)
	s.bucket = s3.Bucket(s.Bucket)
	return s, nil
}
func SafeCreateS3Bucket ( domain , bucket , accessKey , secretKey string ) ( * S3Bucket , error ) { s := & S3Bucket { Bucket : bucket , Name : " " , Domain : domain , AccessKey : accessKey , SecretKey : secretKey , } if s . Bucket == " " { return nil , errors . New ( " " ) } var k s3gof3r . Keys var err error if s . AccessKey == " " || s . SecretKey == " " { k , err = s3gof3r . EnvKeys ( ) // get S3 keys from environment if err != nil { return nil , err } } else { k = s3gof3r . Keys { AccessKey : s . AccessKey , SecretKey : s . SecretKey , } } s3 := s3gof3r . New ( s . Domain , k ) s . bucket = s3 . Bucket ( s . Bucket ) return s , nil }
//SafeCreateS3Bucket creates an s3 bucket for storing files to an s3-compatible blobstore
SafeCreateS3Bucket creates an s3 bucket for storing files to an s3 - compatible blobstore