MCPcopy Index your code
hub / github.com/GoogleCloudPlatform/cloud-sql-proxy / withDefaults

Function withDefaults

cmd/root_test.go:36–67  ·  view source on GitHub ↗
(c *proxy.Config)

Source from the content-addressed store, hash-verified

34)
35
36func withDefaults(c *proxy.Config) *proxy.Config {
37 if c.UserAgent == "" {
38 c.UserAgent = userAgent
39 }
40 if c.Addr == "" {
41 c.Addr = "127.0.0.1"
42 }
43 if c.FUSEDir == "" {
44 if c.Instances == nil {
45 c.Instances = []proxy.InstanceConnConfig{{}}
46 }
47 if i := &c.Instances[0]; i.Name == "" {
48 i.Name = "proj:region:inst"
49 }
50 }
51 if c.FUSETempDir == "" {
52 c.FUSETempDir = filepath.Join(os.TempDir(), "csql-tmp")
53 }
54 if c.HTTPAddress == "" {
55 c.HTTPAddress = "localhost"
56 }
57 if c.HTTPPort == "" {
58 c.HTTPPort = "9090"
59 }
60 if c.AdminPort == "" {
61 c.AdminPort = "9091"
62 }
63 if c.TelemetryTracingSampleRate == 0 {
64 c.TelemetryTracingSampleRate = 10_000
65 }
66 return c
67}
68
69// pointer returns the address of v and makes it easy to take the address of a
70// predeclared identifier. Compare:

Calls

no outgoing calls

Tested by

no test coverage detected