MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / formatEnvLine

Function formatEnvLine

agent/utils/env/env.go:88–96  ·  view source on GitHub ↗
(k, v string)

Source from the content-addressed store, hash-verified

86}
87
88func formatEnvLine(k, v string) string {
89 if d, err := strconv.Atoi(v); err == nil && !isStartWithZero(v) {
90 return fmt.Sprintf(`%s=%d`, k, d)
91 } else if shouldUseSingleQuotes(v) {
92 return fmt.Sprintf(`%s='%s'`, k, v)
93 } else {
94 return fmt.Sprintf(`%s="%s"`, k, escapeDoubleQuotedEnvValue(v))
95 }
96}
97
98func GetEnvValueByKey(envPath, key string) (string, error) {
99 envMap, err := godotenv.Read(envPath)

Callers 1

MarshalWithOrderFunction · 0.85

Calls 3

isStartWithZeroFunction · 0.85
shouldUseSingleQuotesFunction · 0.85

Tested by

no test coverage detected