atri.dad/lib/s3.go

15 lines
234 B
Go
Raw Normal View History

2023-05-18 20:04:55 -06:00
package lib
import (
"fmt"
"os"
)
func GeneratePublicURL(key string) string {
bucket := os.Getenv("BUCKET_NAME")
endpoint := os.Getenv("AWS_ENDPOINT_URL_S3")
url := fmt.Sprintf("%s/%s/%s", endpoint, bucket, key)
return url
}