MCPcopy Create free account
hub / github.com/nhost/nhost / configserver

Function configserver

cli/dockercompose/configserver.go:9–115  ·  view source on GitHub ↗
( //nolint: funlen
	image,
	rootPath,
	nhostPath,
	projectName,
	appID string,
	useTLS bool,
	runServices ...*RunService,
)

Source from the content-addressed store, hash-verified

7)
8
9func configserver( //nolint: funlen
10 image,
11 rootPath,
12 nhostPath,
13 projectName,
14 appID string,
15 useTLS bool,
16 runServices ...*RunService,
17) (*Service, error) {
18 bindings := make([]Volume, 0, len(runServices))
19 extraArgs := make([]string, len(runServices))
20
21 mountedVolumes := make([]string, 0, len(runServices))
22 for i, runService := range runServices {
23 source := filepath.Dir(runService.Path)
24 target := filepath.Join("/tmp", source)
25 targetFile := filepath.Join(target, filepath.Base(runService.Path))
26
27 extraArgs[i] = "--storage-local-run-services-path=" + targetFile
28
29 if slices.Contains(mountedVolumes, source) {
30 continue
31 }
32
33 mountedVolumes = append(mountedVolumes, source)
34
35 bindings = append(bindings, Volume{
36 Type: "bind",
37 Source: source,
38 Target: target,
39 ReadOnly: new(bool),
40 })
41 }
42
43 dockerURL, err := getDockerHost()
44 if err != nil {
45 return nil, fmt.Errorf("failed to get docker host: %w", err)
46 }
47
48 volumes := append(
49 []Volume{
50 {
51 Type: "bind",
52 Source: nhostPath,
53 Target: "/tmp/root/nhost",
54 ReadOnly: new(false),
55 },
56 {
57 Type: "bind",
58 Source: rootPath,
59 Target: "/tmp/root",
60 ReadOnly: new(false),
61 },
62 },
63 bindings...,
64 )
65
66 dockerEndpoint := dockerURL.String()

Callers 2

getServicesCloudFunction · 0.85
getServicesFunction · 0.85

Calls 5

getDockerHostFunction · 0.85
traefikHostMatchFunction · 0.85
ErrorfMethod · 0.80
StringMethod · 0.45
LabelsMethod · 0.45

Tested by

no test coverage detected