@@ -141,6 +141,7 @@ type Tile struct {
141141 // Source string `json:"source,omitempty" yaml:"source,omitempty"`
142142 Source string `json:"source" yaml:"source"`
143143 Upstream string `json:"upstream,omitempty" yaml:"upstream,omitempty"`
144+ Remote Remote `json:"remote,omitempty" yaml:"remote,omitempty"`
144145 Icon string `json:"icon" yaml:"icon"`
145146 Tools []servers.Tool `json:"tools" yaml:"tools"`
146147 Secrets []Secret `json:"secrets,omitempty" yaml:"secrets,omitempty"`
@@ -197,3 +198,47 @@ type Env struct {
197198 Name string `json:"name" yaml:"name"`
198199 Value string `json:"value" yaml:"value"`
199200}
201+
202+ type Remote struct {
203+ TransportType string `json:"transport_type,omitempty" yaml:"transport_type,omitempty"`
204+ URL string `json:"url,omitempty" yaml:"url,omitempty"`
205+ Headers map [string ]string `json:"headers,omitempty" yaml:"headers,omitempty"`
206+ }
207+
208+ func (r Remote ) MarshalYAML () (interface {}, error ) {
209+ mapNode := & yaml.Node {
210+ Kind : yaml .MappingNode ,
211+ Content : []* yaml.Node {},
212+ }
213+
214+ if r .TransportType != "" {
215+ mapNode .Content = append (mapNode .Content ,
216+ & yaml.Node {Kind : yaml .ScalarNode , Value : "transport_type" },
217+ & yaml.Node {Kind : yaml .ScalarNode , Value : r .TransportType })
218+ }
219+
220+ if r .URL != "" {
221+ mapNode .Content = append (mapNode .Content ,
222+ & yaml.Node {Kind : yaml .ScalarNode , Value : "url" },
223+ & yaml.Node {Kind : yaml .ScalarNode , Value : r .URL })
224+ }
225+
226+ if len (r .Headers ) > 0 {
227+ headersNode := & yaml.Node {
228+ Kind : yaml .MappingNode ,
229+ Content : []* yaml.Node {},
230+ }
231+
232+ for k , v := range r .Headers {
233+ headersNode .Content = append (headersNode .Content ,
234+ & yaml.Node {Kind : yaml .ScalarNode , Value : k },
235+ & yaml.Node {Kind : yaml .ScalarNode , Value : v , Style : yaml .DoubleQuotedStyle })
236+ }
237+
238+ mapNode .Content = append (mapNode .Content ,
239+ & yaml.Node {Kind : yaml .ScalarNode , Value : "headers" },
240+ headersNode )
241+ }
242+
243+ return mapNode , nil
244+ }
0 commit comments