Tell the user to set the S3 keys before an s3:// storage_url (closes #428)
check / check (push) Successful in 12m48s
check / check (push) Successful in 12m48s
config set storage_url to an s3:// URL was refused, without saying why, when s3.access_key_id and s3.secret_access_key were not yet set. The refusal now names both keys and says to set them first. config set still refuses any change that leaves the config unable to load, and clearing a key gets the plain refusal. Model: opus-5-5
This commit was merged in pull request #454.
This commit is contained in:
1 parent
e8ab13b526
commit
5f1f8c4f66
3 files changed
+127
-7
No files matched your search
@@ -79,8 +79,13 @@ var (
|
||||
"storage not configured; set storage_url or provide s3.endpoint + " +
|
||||
"s3.bucket + credentials")
|
||||
errS3BucketRequired = errors.New("s3.bucket is required (or set storage_url)")
|
||||
errS3KeyIDRequired = errors.New("s3.access_key_id is required")
|
||||
errS3SecretRequired = errors.New("s3.secret_access_key is required")
|
||||
)
|
||||
|
||||
// Validate returns these when S3 storage is configured without its
|
||||
// credentials.
|
||||
var (
|
||||
ErrS3KeyIDRequired = errors.New("s3.access_key_id is required")
|
||||
ErrS3SecretRequired = errors.New("s3.secret_access_key is required")
|
||||
)
|
||||
|
||||
// expandTilde expands ~ at the start of a path to the user's home directory.
|
||||
@@ -524,11 +529,11 @@ func (c *Config) validateStorage() error {
|
||||
}
|
||||
|
||||
if c.S3.AccessKeyID == "" {
|
||||
return errS3KeyIDRequired
|
||||
return ErrS3KeyIDRequired
|
||||
}
|
||||
|
||||
if c.S3.SecretAccessKey == "" {
|
||||
return errS3SecretRequired
|
||||
return ErrS3SecretRequired
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -555,11 +560,11 @@ func (c *Config) validateStorageURL() error {
|
||||
case strings.HasPrefix(c.StorageURL, "s3://"):
|
||||
// S3 storage needs credentials
|
||||
if c.S3.AccessKeyID == "" {
|
||||
return fmt.Errorf("%w for s3:// URLs", errS3KeyIDRequired)
|
||||
return fmt.Errorf("%w for s3:// URLs", ErrS3KeyIDRequired)
|
||||
}
|
||||
|
||||
if c.S3.SecretAccessKey == "" {
|
||||
return fmt.Errorf("%w for s3:// URLs", errS3SecretRequired)
|
||||
return fmt.Errorf("%w for s3:// URLs", ErrS3SecretRequired)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user