diff --git a/agent/app/service/runtime_utils.go b/agent/app/service/runtime_utils.go index 14511df79..b36129d1f 100644 --- a/agent/app/service/runtime_utils.go +++ b/agent/app/service/runtime_utils.go @@ -671,13 +671,7 @@ func getDockerComposeEnvironments(yml []byte) ([]request.Environment, error) { } var res []request.Environment for _, service := range composeProject.Services { - for _, env := range service.Environment { - envArray := strings.Split(env, ":") - key := envArray[0] - value := "" - if len(envArray) > 1 { - value = envArray[1] - } + for key, value := range service.Environment.Variables { res = append(res, request.Environment{ Key: key, Value: value, diff --git a/agent/utils/docker/compose.go b/agent/utils/docker/compose.go index 28e2bba3a..37adab8f6 100644 --- a/agent/utils/docker/compose.go +++ b/agent/utils/docker/compose.go @@ -53,9 +53,41 @@ type ComposeProject struct { } type Service struct { - Image string `yaml:"image"` - Environment []string `yaml:"environment"` - Volumes []string `json:"volumes"` + Image string `yaml:"image"` + Environment Environment `yaml:"environment"` + Volumes []string `json:"volumes"` +} + +type Environment struct { + Variables map[string]string +} + +func (e *Environment) UnmarshalYAML(value *yaml.Node) error { + e.Variables = make(map[string]string) + switch value.Kind { + case yaml.MappingNode: + for i := 0; i < len(value.Content); i += 2 { + key := value.Content[i].Value + val := value.Content[i+1].Value + e.Variables[key] = val + } + case yaml.SequenceNode: + for _, item := range value.Content { + var kv string + if err := item.Decode(&kv); err != nil { + return err + } + parts := strings.SplitN(kv, "=", 2) + if len(parts) == 2 { + e.Variables[parts[0]] = parts[1] + } else { + e.Variables[parts[0]] = "" + } + } + default: + return fmt.Errorf("unsupported environment format") + } + return nil } func replaceEnvVariables(input string, envVars map[string]string) string { diff --git a/frontend/src/views/website/runtime/dotnet/index.vue b/frontend/src/views/website/runtime/dotnet/index.vue index 5ecaaee75..27c596ee2 100644 --- a/frontend/src/views/website/runtime/dotnet/index.vue +++ b/frontend/src/views/website/runtime/dotnet/index.vue @@ -68,7 +68,7 @@ fix /> @@ -103,6 +103,11 @@ import { ElMessageBox } from 'element-plus'; import RuntimeStatus from '@/views/website/runtime/components/runtime-status.vue'; import PortJump from '@/views/website/runtime/components/port-jump.vue'; import { disabledButton } from '@/utils/runtime'; +import { GlobalStore } from '@/store'; +const globalStore = GlobalStore(); +const mobile = computed(() => { + return globalStore.isMobile(); +}); let timer: NodeJS.Timer | null = null; const loading = ref(false); diff --git a/frontend/src/views/website/runtime/java/index.vue b/frontend/src/views/website/runtime/java/index.vue index acf1a5b34..d0930fd3a 100644 --- a/frontend/src/views/website/runtime/java/index.vue +++ b/frontend/src/views/website/runtime/java/index.vue @@ -68,11 +68,11 @@ fix /> @@ -103,6 +103,11 @@ import { ElMessageBox } from 'element-plus'; import RuntimeStatus from '@/views/website/runtime/components/runtime-status.vue'; import PortJump from '@/views/website/runtime/components/port-jump.vue'; import { disabledButton } from '@/utils/runtime'; +import { GlobalStore } from '@/store'; +const globalStore = GlobalStore(); +const mobile = computed(() => { + return globalStore.isMobile(); +}); let timer: NodeJS.Timer | null = null; const loading = ref(false); diff --git a/frontend/src/views/website/runtime/node/index.vue b/frontend/src/views/website/runtime/node/index.vue index 3f8eb144c..ed7972cdf 100644 --- a/frontend/src/views/website/runtime/node/index.vue +++ b/frontend/src/views/website/runtime/node/index.vue @@ -68,11 +68,11 @@ fix /> @@ -105,6 +105,11 @@ import { ElMessageBox } from 'element-plus'; import RuntimeStatus from '@/views/website/runtime/components/runtime-status.vue'; import PortJump from '@/views/website/runtime/components/port-jump.vue'; import { disabledButton } from '@/utils/runtime'; +import { GlobalStore } from '@/store'; +const globalStore = GlobalStore(); +const mobile = computed(() => { + return globalStore.isMobile(); +}); let timer: NodeJS.Timer | null = null; const loading = ref(false); diff --git a/frontend/src/views/website/runtime/php/index.vue b/frontend/src/views/website/runtime/php/index.vue index 8c21902d6..28e163f9e 100644 --- a/frontend/src/views/website/runtime/php/index.vue +++ b/frontend/src/views/website/runtime/php/index.vue @@ -85,11 +85,11 @@ fix /> @@ -128,6 +128,11 @@ import Config from '@/views/website/runtime/php/config/index.vue'; import Supervisor from '@/views/website/runtime/php/supervisor/index.vue'; import RuntimeStatus from '@/views/website/runtime/components/runtime-status.vue'; import { disabledButton } from '@/utils/runtime'; +import { GlobalStore } from '@/store'; +const globalStore = GlobalStore(); +const mobile = computed(() => { + return globalStore.isMobile(); +}); const paginationConfig = reactive({ cacheSizeKey: 'runtime-page-size', diff --git a/frontend/src/views/website/runtime/python/index.vue b/frontend/src/views/website/runtime/python/index.vue index d363e3481..0f34fa05e 100644 --- a/frontend/src/views/website/runtime/python/index.vue +++ b/frontend/src/views/website/runtime/python/index.vue @@ -68,11 +68,11 @@ fix /> @@ -103,6 +103,11 @@ import { ElMessageBox } from 'element-plus'; import RuntimeStatus from '@/views/website/runtime/components/runtime-status.vue'; import PortJump from '@/views/website/runtime/components/port-jump.vue'; import { disabledButton } from '@/utils/runtime'; +import { GlobalStore } from '@/store'; +const globalStore = GlobalStore(); +const mobile = computed(() => { + return globalStore.isMobile(); +}); let timer: NodeJS.Timer | null = null; const loading = ref(false);