changed renew sas check
This commit is contained in:
parent
01dd4c6290
commit
0a3c465555
|
@ -152,8 +152,8 @@ func NewAzureService(config *AzConfig) (AzService, error) {
|
||||||
func (service *azService) NewBlob(ctx context.Context, name string) (AzBlob, error) {
|
func (service *azService) NewBlob(ctx context.Context, name string) (AzBlob, error) {
|
||||||
var fileBlob AzBlob
|
var fileBlob AzBlob
|
||||||
url := service.ContainerURL.URL()
|
url := service.ContainerURL.URL()
|
||||||
skeParam := url.Query().Get("ske")
|
if service.SasUrl != "" {
|
||||||
if skeParam != "" {
|
skeParam := url.Query().Get("ske")
|
||||||
sasEndDate, _ := time.Parse(time.RFC3339, skeParam)
|
sasEndDate, _ := time.Parse(time.RFC3339, skeParam)
|
||||||
if sasEndDate.Before(time.Now()) {
|
if sasEndDate.Before(time.Now()) {
|
||||||
// Renew SAS and append it to URL
|
// Renew SAS and append it to URL
|
||||||
|
@ -355,5 +355,6 @@ func getSasToken(sasUrl string) (sas string, err error) {
|
||||||
if readErr != nil {
|
if readErr != nil {
|
||||||
return "", readErr
|
return "", readErr
|
||||||
}
|
}
|
||||||
|
fmt.Println("Requested SAS Token.")
|
||||||
return string(sasResponse), nil
|
return string(sasResponse), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue