summaryrefslogtreecommitdiff
path: root/internal/config/validate.go
diff options
context:
space:
mode:
authorLibravatar CDN <cardinal@codeword.info>2024-07-31 20:44:18 +0800
committerLibravatar GitHub <noreply@github.com>2024-07-31 13:44:18 +0100
commit43519324b39de697e3403691fb286de03bf0d4d1 (patch)
tree5a179a34b7bff4e261b7cffaf700a96cbd18246c /internal/config/validate.go
parentFix no rows in result set error in emoji list command (#3152) (diff)
downloadgotosocial-43519324b39de697e3403691fb286de03bf0d4d1.tar.xz
[feature] Object store custom URL (S3) (#3046)
* tweaks * boobs * fix variable name + typo --------- Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal/config/validate.go')
-rw-r--r--internal/config/validate.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/config/validate.go b/internal/config/validate.go
index d79d83b9d..723d5c931 100644
--- a/internal/config/validate.go
+++ b/internal/config/validate.go
@@ -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,