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

Function replaceEnv

pkg/devspace/services/podreplace/builder.go:376–395  ·  view source on GitHub ↗
(ctx devspacecontext.Context, devPod *latest.DevPod, devContainer *latest.DevContainer, podTemplate *corev1.PodTemplateSpec)

Source from the content-addressed store, hash-verified

374}
375
376func replaceEnv(ctx devspacecontext.Context, devPod *latest.DevPod, devContainer *latest.DevContainer, podTemplate *corev1.PodTemplateSpec) error {
377 if len(devContainer.Env) == 0 {
378 return nil
379 }
380
381 index, container, err := getPodTemplateContainer(ctx, devPod, devContainer, podTemplate)
382 if err != nil {
383 return err
384 }
385
386 for _, v := range devContainer.Env {
387 container.Env = append(container.Env, corev1.EnvVar{
388 Name: v.Name,
389 Value: v.Value,
390 })
391 }
392
393 podTemplate.Spec.Containers[index] = *container
394 return nil
395}
396
397func replaceAttach(ctx devspacecontext.Context, devPod *latest.DevPod, devContainer *latest.DevContainer, podTemplate *corev1.PodTemplateSpec) error {
398 if devContainer.Attach == nil || devContainer.Attach.DisableReplace || (devContainer.Attach.Enabled != nil && !*devContainer.Attach.Enabled) {

Callers 1

modifyDevContainerFunction · 0.85

Calls 1

getPodTemplateContainerFunction · 0.85

Tested by

no test coverage detected