-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clients: Download manifest from backup OS
- Loading branch information
Showing
4 changed files
with
96 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package config | ||
|
||
import "strings" | ||
|
||
// GetStorageBackupURL returns the backup URL for the given URL or an empty string if it doesn't exist. The backup URL | ||
// is found by checking the `StorageFallbackURLs` global config map. If any of the primary URL prefixes (keys in map) | ||
// are in `urlStr`, it is replaced with the backup URL prefix (associated value of the key in the map). | ||
func GetStorageBackupURL(urlStr string) string { | ||
for primary, backup := range StorageFallbackURLs { | ||
if strings.HasPrefix(urlStr, primary) { | ||
return strings.Replace(urlStr, primary, backup, 1) | ||
} | ||
} | ||
return "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters