mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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:
@@ -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,
|
||||
|
Reference in New Issue
Block a user