[#78] enable fully qualified URIs for S3 endpoints and improved error reporting when uploading or deleting files
This commit is contained in:
+1
-1
@@ -255,7 +255,7 @@ type S3Config struct {
|
||||
// Validate makes S3Config validatable by implementing [validation.Validatable] interface.
|
||||
func (c S3Config) Validate() error {
|
||||
return validation.ValidateStruct(&c,
|
||||
validation.Field(&c.Endpoint, is.Host, validation.When(c.Enabled, validation.Required)),
|
||||
validation.Field(&c.Endpoint, is.URL, validation.When(c.Enabled, validation.Required)),
|
||||
validation.Field(&c.Bucket, validation.When(c.Enabled, validation.Required)),
|
||||
validation.Field(&c.Region, validation.When(c.Enabled, validation.Required)),
|
||||
validation.Field(&c.AccessKey, validation.When(c.Enabled, validation.Required)),
|
||||
|
||||
+13
-1
@@ -315,7 +315,19 @@ func TestS3ConfigValidate(t *testing.T) {
|
||||
},
|
||||
true,
|
||||
},
|
||||
// valid data
|
||||
// valid data (url endpoint)
|
||||
{
|
||||
core.S3Config{
|
||||
Enabled: true,
|
||||
Endpoint: "https://localhost:8090",
|
||||
Bucket: "test",
|
||||
Region: "test",
|
||||
AccessKey: "test",
|
||||
Secret: "test",
|
||||
},
|
||||
false,
|
||||
},
|
||||
// valid data (hostname endpoint)
|
||||
{
|
||||
core.S3Config{
|
||||
Enabled: true,
|
||||
|
||||
Reference in New Issue
Block a user