File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ package config
22
33import (
44 "github.com/ctfer-io/recipes/chall-manager/common"
5+
6+ k8s "github.com/ctfer-io/chall-manager/sdk/kubernetes"
57)
68
79type Config struct {
@@ -22,7 +24,7 @@ type Config struct {
2224type ContainerArgs struct {
2325 Image string `form:"image" json:"image"`
2426 Ports []common.PortArgs `form:"ports" json:"ports"`
25- Envs map [string ]common. Variable `form:"envs" json:"envs"`
27+ Envs map [string ]Printable `form:"envs" json:"envs"`
2628 Files map [string ]common.Variable `form:"files" json:"files"`
2729 Requests map [string ]string `form:"requests" json:"requests"`
2830 Limits map [string ]string `form:"limits" json:"limits"`
@@ -34,3 +36,17 @@ type RuleArgs struct {
3436 On int `form:"on" json:"on"`
3537 Protocol string `form:"protocol" json:"protocol"`
3638}
39+
40+ type Printable struct {
41+ Variable common.Variable `form:"variable" json:"variable"`
42+
43+ Format string `form:"format" json:"format"`
44+ Serivces []string `form:"services" json:"services"`
45+ }
46+
47+ func (pr Printable ) ToPrinter (seed string ) k8s.PrinterArgs {
48+ if pr .Variable .Content != "" {
49+ return k8s .NewPrinter (pr .Variable .Produce (seed ))
50+ }
51+ return k8s .NewPrinter (pr .Format , pr .Serivces ... )
52+ }
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ func main() {
5454 Envs : func () k8s.PrinterMap {
5555 out := map [string ]k8s.PrinterInput {}
5656 for k , v := range args .Envs {
57- out [k ] = k8s . NewPrinter ( v . Produce (req .Identity ) )
57+ out [k ] = v . ToPrinter (req .Identity )
5858 }
5959 return out
6060 }(),
You can’t perform that action at this time.
0 commit comments