61 lines
1.2 KiB
Go
61 lines
1.2 KiB
Go
package spec
|
|
|
|
import (
|
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
|
edgeAuth "forge.cadoles.com/arcad/edge/pkg/module/auth/http"
|
|
)
|
|
|
|
const Name spec.Name = "app.emissary.cadoles.com"
|
|
|
|
type Spec struct {
|
|
Revision int `json:"revision"`
|
|
Apps map[string]AppEntry `json:"apps"`
|
|
Config *Config `json:"config"`
|
|
}
|
|
|
|
type AppEntry struct {
|
|
URL string `json:"url"`
|
|
SHA256Sum string `json:"sha256sum"`
|
|
Address string `json:"address"`
|
|
Format string `json:"format"`
|
|
}
|
|
|
|
type Auth struct {
|
|
Local *LocalAuth `json:"local,omitempty"`
|
|
}
|
|
|
|
type LocalAuth struct {
|
|
Key any `json:"key"`
|
|
Accounts []edgeAuth.LocalAccount `json:"accounts"`
|
|
CookieDomain string `json:"cookieDomain"`
|
|
CookieDuration string `json:"cookieDuration"`
|
|
}
|
|
|
|
type Config struct {
|
|
Auth *Auth `json:"auth"`
|
|
AppURLTemplate string `json:"appUrlTemplate"`
|
|
}
|
|
|
|
func (s *Spec) SpecName() spec.Name {
|
|
return Name
|
|
}
|
|
|
|
func (s *Spec) SpecRevision() int {
|
|
return s.Revision
|
|
}
|
|
|
|
func (s *Spec) SpecData() map[string]any {
|
|
return map[string]any{
|
|
"apps": s.Apps,
|
|
"config": s.Config,
|
|
}
|
|
}
|
|
|
|
func NewSpec() *Spec {
|
|
return &Spec{
|
|
Revision: -1,
|
|
}
|
|
}
|
|
|
|
var _ spec.Spec = &Spec{}
|