2023-05-25 14:46:52 +03:00
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"
2023-08-02 21:58:34 +03:00
"zotregistry.io/zot/pkg/log"
mTypes "zotregistry.io/zot/pkg/meta/types"
"zotregistry.io/zot/pkg/scheduler"
2023-05-25 14:46:52 +03:00
)
func GetExtensions ( config * config . Config ) distext . ExtensionList {
extensionList := distext . ExtensionList { }
endpoints := [ ] string { }
extensions := [ ] distext . Extension { }
2023-08-02 21:58:34 +03:00
if config . IsNotationEnabled ( ) && IsBuiltWithImageTrustExtension ( ) {
endpoints = append ( endpoints , constants . FullNotation )
}
if config . IsCosignEnabled ( ) && IsBuiltWithImageTrustExtension ( ) {
endpoints = append ( endpoints , constants . FullCosign )
}
2023-05-25 14:46:52 +03:00
2023-08-02 21:58:34 +03:00
if config . IsSearchEnabled ( ) && IsBuiltWithSearchExtension ( ) {
endpoints = append ( endpoints , constants . FullSearchPrefix )
2023-05-25 14:46:52 +03:00
}
2023-08-02 21:58:34 +03:00
if config . AreUserPrefsEnabled ( ) && IsBuiltWithUserPrefsExtension ( ) {
endpoints = append ( endpoints , constants . FullUserPrefs )
}
if config . IsMgmtEnabled ( ) && IsBuiltWithMGMTExtension ( ) {
endpoints = append ( endpoints , constants . FullMgmt )
2023-05-25 14:46:52 +03:00
}
if len ( endpoints ) > 0 {
extensions = append ( extensions , distext . Extension {
2023-08-30 20:12:24 +03:00
Name : constants . BaseExtension ,
2023-05-25 14:46:52 +03:00
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
}
2023-08-02 21:58:34 +03:00
func EnableScheduledTasks ( conf * config . Config , taskScheduler * scheduler . Scheduler ,
metaDB mTypes . MetaDB , log log . Logger ,
) {
EnableImageTrustVerification ( conf , taskScheduler , metaDB , log )
}
2023-09-08 10:03:58 +03:00
func SetupExtensions ( conf * config . Config , metaDB mTypes . MetaDB , log log . Logger ) error {
return SetupImageTrustExtension ( conf , metaDB , log )
}