@@ -91,6 +91,9 @@ type BlockingConfiguration struct {
9191 Timeout string `json:"timeout"`
9292}
9393
94+ type PokeConfiguration struct {
95+ }
96+
9497type Config struct {
9598 // SablierURL in the format of hostname:port. The scheme is excluded
9699 SablierURL string `json:"sablier_url"`
@@ -105,6 +108,7 @@ type Config struct {
105108 SessionDuration string `json:"session_duration"`
106109 Dynamic * DynamicConfiguration `json:"dynamic"`
107110 Blocking * BlockingConfiguration `json:"blocking"`
111+ Poke * PokeConfiguration `json:"poke"`
108112}
109113
110114func (c Config ) GetPath () string {
@@ -133,6 +137,8 @@ func (c Config) GetPath() string {
133137 return c .getDynamicQuery (path )
134138 } else if c .Blocking != nil {
135139 return c .getBlockingQuery (path )
140+ } else if c .Poke != nil {
141+ return c .getPokeQuery (path )
136142 }
137143 return "no strategy configured"
138144}
@@ -183,6 +189,12 @@ func (c Config) getBlockingQuery(path url.URL) string {
183189 return path .String ()
184190}
185191
192+ func (c Config ) getPokeQuery (path url.URL ) string {
193+ path .Path = "/api/strategies/poke"
194+
195+ return path .String ()
196+ }
197+
186198func parsePluginConfiguration (data []byte ) (pluginConfiguration , error ) {
187199 pluginConf := newPluginConfiguration ()
188200 if len (data ) == 0 {
@@ -196,11 +208,20 @@ func parsePluginConfiguration(data []byte) (pluginConfiguration, error) {
196208 return pluginConf , err
197209 }
198210
199- if c .Blocking == nil && c .Dynamic == nil {
200- return pluginConf , fmt .Errorf ("you must specify one strategy (dynamic or blocking)" )
211+ strategyCount := 0
212+ if c .Blocking != nil {
213+ strategyCount ++
201214 }
202-
203- if c .Blocking != nil && c .Dynamic != nil {
215+ if c .Dynamic != nil {
216+ strategyCount ++
217+ }
218+ if c .Poke != nil {
219+ strategyCount ++
220+ }
221+ if strategyCount == 0 {
222+ return pluginConf , fmt .Errorf ("you must specify one strategy (dynamic, blocking or poke)" )
223+ }
224+ if strategyCount > 1 {
204225 return pluginConf , fmt .Errorf ("you must specify only one strategy" )
205226 }
206227
0 commit comments