MCPcopy Index your code
hub / github.com/devspace-sh/devspace / returnConfig

Method returnConfig

pkg/devspace/server/server.go:221–264  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

219}
220
221func (h *handler) returnConfig(w http.ResponseWriter, r *http.Request) {
222 profile := ""
223 retConfig := &returnConfig{
224 AnalyticsEnabled: h.analyticsEnabled,
225 Profile: profile,
226 WorkingDirectory: h.ctx.WorkingDir(),
227 KubeContexts: h.kubeContexts,
228 }
229 if h.ctx.Config() != nil {
230 retConfig.RawConfig = h.ctx.Config().Raw()
231 retConfig.Config = h.ctx.Config().Config()
232 retConfig.LocalCache = localCache{
233 Vars: h.ctx.Config().Variables(),
234 LastContext: h.ctx.Config().LocalCache().GetLastContext(),
235 }
236 }
237 if h.ctx.KubeClient() != nil {
238 retConfig.KubeNamespace = h.ctx.KubeClient().Namespace()
239 retConfig.KubeContext = h.ctx.KubeClient().CurrentContext()
240 }
241
242 s, err := yaml.Marshal(retConfig)
243 if err != nil {
244 http.Error(w, err.Error(), http.StatusInternalServerError)
245 return
246 }
247
248 var data interface{}
249 if err := yamlutil.Unmarshal([]byte(s), &data); err != nil {
250 http.Error(w, err.Error(), http.StatusInternalServerError)
251 return
252 }
253
254 data = yamlutil.Convert(data)
255
256 b, err := json.Marshal(data)
257 if err != nil {
258 http.Error(w, err.Error(), http.StatusInternalServerError)
259 return
260 }
261
262 w.Header().Set("Content-Type", "application/json")
263 _, _ = w.Write(b)
264}
265
266func (h *handler) request(w http.ResponseWriter, r *http.Request) {
267 resource, ok := r.URL.Query()["resource"]

Callers

nothing calls this directly

Calls 14

UnmarshalFunction · 0.92
ConvertFunction · 0.92
WorkingDirMethod · 0.65
ConfigMethod · 0.65
RawMethod · 0.65
VariablesMethod · 0.65
GetLastContextMethod · 0.65
LocalCacheMethod · 0.65
KubeClientMethod · 0.65
NamespaceMethod · 0.65
CurrentContextMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected