File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package server
22
33import (
4+ "encoding/json"
45 "sync"
56
67 "github.com/pelican-dev/wings/environment"
@@ -20,6 +21,34 @@ type EggConfiguration struct {
2021 Features map [string ][]string `json:"features"`
2122}
2223
24+ func (egg * EggConfiguration ) UnmarshalJSON (b []byte ) (err error ) {
25+ var eggConfiguration struct {
26+ // The internal UUID of the Egg on the Panel.
27+ ID string `json:"id"`
28+
29+ // Maintains a list of files that are blacklisted for opening/editing/downloading
30+ // or basically any type of access on the server by any user. This is NOT the same
31+ // as a per-user denylist, this is defined at the Egg level.
32+ FileDenylist []string `json:"file_denylist"`
33+
34+ // Features is a map of feature identifiers to a list of console output strings
35+ // that should trigger a match (e.g., for things like EULA prompts).
36+ Features map [string ][]string `json:"features"`
37+ }
38+
39+ // try unmarshalling first
40+ if err := json .Unmarshal (b , & eggConfiguration ); err != nil {
41+ egg .Features = nil
42+ } else {
43+ egg .Features = eggConfiguration .Features
44+ }
45+
46+ egg .ID = eggConfiguration .ID
47+ egg .FileDenylist = eggConfiguration .FileDenylist
48+
49+ return nil
50+ }
51+
2352type ConfigurationMeta struct {
2453 Name string `json:"name"`
2554 Description string `json:"description"`
You can’t perform that action at this time.
0 commit comments