Add skip-verify flag for using self-signed certificates

This commit adds a `skip-verify` flag to the replica configuration
so that it can be used with self-signed certificates. This is useful
when running a local instance of MinIO with TLS for testing.
This commit is contained in:
Ben Johnson
2021-03-27 08:00:09 -06:00
parent ef39987cc7
commit f1d2df3e73
2 changed files with 12 additions and 1 deletions

View File

@@ -276,6 +276,7 @@ type ReplicaConfig struct {
Bucket string `yaml:"bucket"`
Endpoint string `yaml:"endpoint"`
ForcePathStyle *bool `yaml:"force-path-style"`
SkipVerify bool `yaml:"skip-verify"`
}
// NewReplicaFromConfig instantiates a replica for a DB based on a config.
@@ -347,7 +348,7 @@ func newS3ReplicaFromConfig(c *ReplicaConfig, db *litestream.DB) (_ *s3.Replica,
}
bucket, path := c.Bucket, c.Path
region, endpoint := c.Region, c.Endpoint
region, endpoint, skipVerify := c.Region, c.Endpoint, c.SkipVerify
// Use path style if an endpoint is explicitly set. This works because the
// only service to not use path style is AWS which does not use an endpoint.
@@ -396,6 +397,7 @@ func newS3ReplicaFromConfig(c *ReplicaConfig, db *litestream.DB) (_ *s3.Replica,
r.Region = region
r.Endpoint = endpoint
r.ForcePathStyle = forcePathStyle
r.SkipVerify = skipVerify
if v := c.Retention; v > 0 {
r.Retention = v