MCPcopy
hub / github.com/docker/compose / buildEnvPromptMessage

Function buildEnvPromptMessage

pkg/compose/publish.go:583–604  ·  view source on GitHub ↗
(services map[string]*serviceEnvFindings)

Source from the content-addressed store, hash-verified

581}
582
583func buildEnvPromptMessage(services map[string]*serviceEnvFindings) string {
584 var b strings.Builder
585 b.WriteString("you are about to publish env-related declarations within your OCI artifact.\n")
586 b.WriteString("env_file paths and literal values for sensitive-looking keys are embedded as-is in the published YAML;\n")
587 b.WriteString("interpolated values like \"${VAR}\" are kept symbolic and have already been excluded.\n")
588 for _, name := range sortedMapKeys(services) {
589 f := services[name]
590 if f.hasEnvFile {
591 fmt.Fprintf(&b, " service %q: env_file declared\n", name)
592 }
593 if keys := f.sortedSuspiciousKeys(); len(keys) > 0 {
594 quoted := make([]string, len(keys))
595 for i, k := range keys {
596 quoted[i] = fmt.Sprintf("%q", k)
597 }
598 fmt.Fprintf(&b, " service %q: literal value for %s\n", name, strings.Join(quoted, ", "))
599 }
600 }
601 b.WriteString("Use --with-env to silence this prompt and always publish env declarations.\n")
602 b.WriteString("Are you ok to publish these env declarations?")
603 return b.String()
604}
605
606func buildConfigContentPromptMessage(configs []string) string {
607 var b strings.Builder

Callers 1

Calls 3

sortedMapKeysFunction · 0.85
sortedSuspiciousKeysMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected