28 lines
1.4 KiB
Go
28 lines
1.4 KiB
Go
package controlplanerpc
|
|
|
|
import "github.com/samcharles93/archie-core/internal/domain/distribution"
|
|
|
|
// ExtensionSettingsKind is the control-plane resource kind holding which
|
|
// installed extensions are enabled and how each is configured.
|
|
const ExtensionSettingsKind = "extension-settings"
|
|
|
|
// ExtensionSettings is the extension-settings resource document.
|
|
type ExtensionSettings struct {
|
|
Extensions []ExtensionSetting `json:"extensions"`
|
|
CatalogueSource string `json:"catalogue_source,omitempty" title:"Catalogue source" doc:"OCI repository the package catalogue is published to, read at its latest tag. Blank uses the official catalogue."`
|
|
CatalogueKey string `json:"catalogue_key,omitempty" title:"Catalogue signing key" doc:"Base64 ed25519 public key the catalogue source signs with. Required with a source."`
|
|
}
|
|
|
|
// Catalogue is the distribution source the settings name.
|
|
func (s ExtensionSettings) Catalogue() (distribution.Source, error) {
|
|
return distribution.Parse(s.CatalogueSource, s.CatalogueKey, distribution.DefaultCatalogue())
|
|
}
|
|
|
|
// ExtensionSetting enables or disables one installed extension by package name.
|
|
// Settings reach the extension through its surface's Configure call.
|
|
type ExtensionSetting struct {
|
|
Name string `json:"name"`
|
|
Enabled bool `json:"enabled"`
|
|
Settings map[string]string `json:"settings,omitempty"`
|
|
}
|