mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
use constants for default CDN paths
This commit is contained in:
parent
3aa51df74d
commit
9537fb73c0
@ -175,12 +175,12 @@ func getCompatibleImageMeasurements(ctx context.Context, cmd *cobra.Command, cli
|
||||
) (map[string]config.UpgradeConfig, error) {
|
||||
upgrades := make(map[string]config.UpgradeConfig)
|
||||
for _, img := range images {
|
||||
measurementsURL, err := url.Parse(constants.CDNRepositoryURL + path.Join("/constellation/v1/measurements/", img, strings.ToLower(csp.String()), "measurements.json"))
|
||||
measurementsURL, err := url.Parse(constants.CDNRepositoryURL + path.Join("/", constants.CDNMeasurementsPath, img, strings.ToLower(csp.String()), "measurements.json"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
signatureURL, err := url.Parse(constants.CDNRepositoryURL + path.Join("/constellation/v1/measurements/", img, strings.ToLower(csp.String()), "measurements.json.sig"))
|
||||
signatureURL, err := url.Parse(constants.CDNRepositoryURL + path.Join("/", constants.CDNMeasurementsPath, img, strings.ToLower(csp.String()), "measurements.json.sig"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ func granularityFromVersion(version string) (string, error) {
|
||||
}
|
||||
|
||||
func versionJSONPath(granularity, base string) string {
|
||||
return path.Join("constellation/v1/updates", stream, granularity, base, imageKind+".json")
|
||||
return path.Join(constants.CDNUpdatesPath, stream, granularity, base, imageKind+".json")
|
||||
}
|
||||
|
||||
func versionURL(granularity, base string) string {
|
||||
|
@ -154,6 +154,8 @@ const (
|
||||
CDNImagePath = "constellation/v1/images"
|
||||
// CDNMeasurementsPath is the default path to image measurements in the CDN repository.
|
||||
CDNMeasurementsPath = "constellation/v1/measurements"
|
||||
// CDNUpdatesPath is the default path to updates in the CDN repository.
|
||||
CDNUpdatesPath = "constellation/v1/updates"
|
||||
)
|
||||
|
||||
// VersionInfo is the version of a binary. Left as a separate variable to allow override during build.
|
||||
|
@ -152,7 +152,7 @@ func getFromURL(ctx context.Context, client httpc, stream, granularity, base, ki
|
||||
return nil, fmt.Errorf("parsing image version repository URL: %w", err)
|
||||
}
|
||||
kindFilename := path.Base(kind) + ".json"
|
||||
url.Path = path.Join("constellation/v1/updates", stream, granularity, base, kindFilename)
|
||||
url.Path = path.Join(constants.CDNUpdatesPath, stream, granularity, base, kindFilename)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url.String(), http.NoBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user