[feature] Object store custom URL (S3) (#3046)

* tweaks

* boobs

* fix variable name + typo

---------

Co-authored-by: tobi <tobi.smethurst@protonmail.com>
This commit is contained in:
CDN
2024-07-31 20:44:18 +08:00
committed by GitHub
parent 26022c2733
commit 43519324b3
8 changed files with 158 additions and 9 deletions

View File

@@ -19,6 +19,8 @@ package config
import (
"fmt"
"net/url"
"strings"
"github.com/miekg/dns"
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
@@ -118,6 +120,28 @@ func Validate() error {
errf("%s must be set", WebAssetBaseDirFlag())
}
// `storage-s3-redirect-url`
if s3RedirectURL := GetStorageS3RedirectURL(); s3RedirectURL != "" {
if strings.HasSuffix(s3RedirectURL, "/") {
errf(
"%s must not end with a trailing slash",
StorageS3RedirectURLFlag(),
)
}
if url, err := url.Parse(s3RedirectURL); err != nil {
errf(
"%s invalid: %w",
StorageS3RedirectURLFlag(), err,
)
} else if url.Scheme != "https" && url.Scheme != "http" {
errf(
"%s scheme must be https or http",
StorageS3RedirectURLFlag(),
)
}
}
// Custom / LE TLS settings.
//
// Only one of custom certs or LE can be set,