emissary/internal/spec/app/spec.go

54 lines
1015 B
Go
Raw Normal View History

package app
import (
"forge.cadoles.com/Cadoles/emissary/internal/spec"
2023-03-21 15:21:19 +01:00
edgeAuth "forge.cadoles.com/arcad/edge/pkg/module/auth/http"
)
const NameApp spec.Name = "app.emissary.cadoles.com"
type Spec struct {
2023-03-21 15:21:19 +01:00
Revision int `json:"revision"`
2023-03-21 13:28:41 +01:00
Apps map[string]AppEntry `json:"apps"`
Auth *Auth `json:"auth"`
}
type AppEntry struct {
URL string `json:"url"`
SHA256Sum string `json:"sha256sum"`
Address string `json:"address"`
Format string `json:"format"`
}
2023-03-21 13:28:41 +01:00
type Auth struct {
2023-03-21 15:21:19 +01:00
Local *LocalAuth `json:"local,omitempty"`
}
type LocalAuth struct {
Key any `json:"key"`
Accounts []edgeAuth.LocalAccount `json:"accounts"`
2023-03-21 13:28:41 +01:00
}
func (s *Spec) SpecName() spec.Name {
return NameApp
}
func (s *Spec) SpecRevision() int {
return s.Revision
}
func (s *Spec) SpecData() map[string]any {
return map[string]any{
"apps": s.Apps,
2023-03-21 13:28:41 +01:00
"auth": s.Auth,
}
}
func NewSpec() *Spec {
2023-03-13 10:44:58 +01:00
return &Spec{
Revision: -1,
}
}
var _ spec.Spec = &Spec{}