MCPcopy Create free account
hub / github.com/datastack-net/dockerized / ExtractVariables

Function ExtractVariables

pkg/dockerized.go:568–594  ·  view source on GitHub ↗
(rawService types.ServiceConfig)

Source from the content-addressed store, hash-verified

566}
567
568func ExtractVariables(rawService types.ServiceConfig) []string {
569 var usedVariables []string
570 for envKey := range rawService.Environment {
571 usedVariables = append(usedVariables, envKey)
572 }
573 if rawService.Build != nil {
574 for _, argValue := range rawService.Build.Args {
575 for _, argValueVariable := range ExtractVariablesFromString(*argValue) {
576 usedVariables = append(usedVariables, argValueVariable)
577 }
578 }
579 }
580 for _, imageVariable := range ExtractVariablesFromString(rawService.Image) {
581 usedVariables = append(usedVariables, imageVariable)
582 }
583
584 for _, entryPointArgument := range rawService.Entrypoint {
585 for _, entryPointVariable := range ExtractVariablesFromString(entryPointArgument) {
586 usedVariables = append(usedVariables, entryPointVariable)
587 }
588 }
589
590 usedVariables = unique(usedVariables)
591 sort.Strings(usedVariables)
592
593 return usedVariables
594}
595
596func ExtractVariablesFromString(value string) []string {
597 var usedVariables []string

Callers 1

SetCommandVersionFunction · 0.85

Calls 2

uniqueFunction · 0.85

Tested by

no test coverage detected