mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
2b8479f7f2
Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package extensions
|
|
|
|
import (
|
|
distext "github.com/opencontainers/distribution-spec/specs-go/v1/extensions"
|
|
|
|
"zotregistry.io/zot/pkg/api/config"
|
|
"zotregistry.io/zot/pkg/api/constants"
|
|
)
|
|
|
|
func GetExtensions(config *config.Config) distext.ExtensionList {
|
|
extensionList := distext.ExtensionList{}
|
|
|
|
endpoints := []string{}
|
|
extensions := []distext.Extension{}
|
|
|
|
if config.Extensions != nil && config.Extensions.Search != nil {
|
|
if IsBuiltWithSearchExtension() {
|
|
endpoints = append(endpoints, constants.FullSearchPrefix)
|
|
}
|
|
|
|
if IsBuiltWithUserPrefsExtension() {
|
|
endpoints = append(endpoints, constants.FullUserPreferencesPrefix)
|
|
}
|
|
}
|
|
|
|
if IsBuiltWithMGMTExtension() && config.Extensions != nil && config.Extensions.Mgmt != nil {
|
|
endpoints = append(endpoints, constants.FullMgmtPrefix)
|
|
}
|
|
|
|
if len(endpoints) > 0 {
|
|
extensions = append(extensions, distext.Extension{
|
|
Name: "_zot",
|
|
URL: "https://github.com/project-zot/zot/blob/" + config.ReleaseTag + "/pkg/extensions/_zot.md",
|
|
Description: "zot registry extensions",
|
|
Endpoints: endpoints,
|
|
})
|
|
}
|
|
|
|
extensionList.Extensions = extensions
|
|
|
|
return extensionList
|
|
}
|