mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
cos backend support accelerate (#31425)
This commit is contained in:
parent
c4a65f8381
commit
0dbf0711a0
@ -113,6 +113,12 @@ func New() backend.Backend {
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"accelerate": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Whether to enable global Acceleration",
|
||||||
|
Default: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +144,16 @@ func (b *Backend) configure(ctx context.Context) error {
|
|||||||
b.encrypt = data.Get("encrypt").(bool)
|
b.encrypt = data.Get("encrypt").(bool)
|
||||||
b.acl = data.Get("acl").(string)
|
b.acl = data.Get("acl").(string)
|
||||||
|
|
||||||
u, err := url.Parse(fmt.Sprintf("https://%s.cos.%s.myqcloud.com", b.bucket, b.region))
|
var (
|
||||||
|
u *url.URL
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
accelerate := data.Get("accelerate").(bool)
|
||||||
|
if accelerate {
|
||||||
|
u, err = url.Parse(fmt.Sprintf("https://%s.cos.accelerate.myqcloud.com", b.bucket))
|
||||||
|
} else {
|
||||||
|
u, err = url.Parse(fmt.Sprintf("https://%s.cos.%s.myqcloud.com", b.bucket, b.region))
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user