MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / CollectLibraryPaths

Function CollectLibraryPaths

pkg/utils/extensions/extensions.go:146–163  ·  view source on GitHub ↗

CollectLibraryPaths returns a list of paths which should be added to LD_LIBRARY_PATH given a list of extensions mounted under baseDir. NOTE: filepath.Join normalizes user-supplied paths (e.g. leading "/", "./" or trailing "/" are cleaned), so "/lib", "./lib", and "lib" all resolve to the same direct

(extensionList []apiv1.ExtensionConfiguration, baseDir string)

Source from the content-addressed store, hash-verified

144// trailing "/" are cleaned), so "/lib", "./lib", and "lib" all resolve to the
145// same directory under the extension mount point.
146func CollectLibraryPaths(extensionList []apiv1.ExtensionConfiguration, baseDir string) []string {
147 capacity := 0
148 for _, ext := range extensionList {
149 capacity += len(ext.LdLibraryPath)
150 }
151 result := make([]string, 0, capacity)
152
153 for _, extension := range extensionList {
154 for _, libraryPath := range extension.LdLibraryPath {
155 result = append(
156 result,
157 filepath.Join(baseDir, extension.Name, libraryPath),
158 )
159 }
160 }
161
162 return result
163}
164
165// dedicatedEnvVars names env vars whose values come from dedicated extension
166// fields (LdLibraryPath, BinPath); custom Env entries targeting them are skipped.

Callers 3

buildPostgresEnvMethod · 0.92
extensions_test.goFile · 0.85

Calls 1

JoinMethod · 0.80

Tested by

no test coverage detected