feat: add env vals textarea

This commit is contained in:
engigu
2026-03-10 19:48:15 +08:00
parent fdfb8fc06a
commit c5a9e287f4
2 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -327,6 +327,7 @@ func ParseEnvVars(envStr string) []string {
// 解码特殊字符 // 解码特殊字符
pair = strings.ReplaceAll(pair, "{{COMMA}}", ",") pair = strings.ReplaceAll(pair, "{{COMMA}}", ",")
pair = strings.ReplaceAll(pair, "{{EQUAL}}", "=") pair = strings.ReplaceAll(pair, "{{EQUAL}}", "=")
pair = strings.ReplaceAll(pair, "{{NL}}", "\n")
result = append(result, pair) result = append(result, pair)
} }
@@ -334,7 +335,7 @@ func ParseEnvVars(envStr string) []string {
} }
// FormatEnvVars 将环境变量列表格式化为逗号分隔的字符串 "KEY1=VALUE1,KEY2=VALUE2" // FormatEnvVars 将环境变量列表格式化为逗号分隔的字符串 "KEY1=VALUE1,KEY2=VALUE2"
// 会对 , 和 = 进行转义 // 会对 , 和 = 以及换行符进行转义
func FormatEnvVars(envs []string) string { func FormatEnvVars(envs []string) string {
if len(envs) == 0 { if len(envs) == 0 {
return "" return ""
@@ -353,6 +354,7 @@ func FormatEnvVars(envs []string) string {
// 转义特殊字符 // 转义特殊字符
encodedValue := strings.ReplaceAll(value, ",", "{{COMMA}}") encodedValue := strings.ReplaceAll(value, ",", "{{COMMA}}")
encodedValue = strings.ReplaceAll(encodedValue, "=", "{{EQUAL}}") encodedValue = strings.ReplaceAll(encodedValue, "=", "{{EQUAL}}")
encodedValue = strings.ReplaceAll(encodedValue, "\n", "{{NL}}")
pairs = append(pairs, fmt.Sprintf("%s=%s", name, encodedValue)) pairs = append(pairs, fmt.Sprintf("%s=%s", name, encodedValue))
} }
+1 -1
View File
@@ -215,7 +215,7 @@ onMounted(loadEnvVars)
</div> </div>
<div class="space-y-2"> <div class="space-y-2">
<Label>变量值</Label> <Label>变量值</Label>
<Input v-model="editingEnv.value" class="font-mono" placeholder="value" /> <Textarea v-model="editingEnv.value" class="font-mono" placeholder="value" rows="5" />
</div> </div>
<div class="space-y-2"> <div class="space-y-2">
<Label>备注</Label> <Label>备注</Label>