func()

in internal/proxy/proxy.go [333:378]


func (c *Config) DialerOptions(l alloydb.Logger) ([]alloydbconn.Option, error) {
	opts := []alloydbconn.Option{
		alloydbconn.WithUserAgent(c.UserAgent),
	}
	co, err := credentialsOpt(*c, l)
	if err != nil {
		return nil, err
	}
	opts = append(opts, co)

	if c.APIEndpointURL != "" {
		opts = append(opts, alloydbconn.WithAdminAPIEndpoint(c.APIEndpointURL))
	}

	if c.AutoIAMAuthN {
		opts = append(opts, alloydbconn.WithIAMAuthN())
	}

	if c.DebugLogs {
		opts = append(opts, alloydbconn.WithDebugLogger(l))
	}

	if c.LazyRefresh {
		opts = append(opts, alloydbconn.WithLazyRefresh())
	}
	if c.StaticConnectionInfo != "" {
		f, err := os.Open(c.StaticConnectionInfo)
		if err != nil {
			return nil, err
		}
		defer f.Close()
		data, err := io.ReadAll(f)
		if err != nil {
			return nil, err
		}
		opts = append(opts, alloydbconn.WithStaticConnectionInfo(
			bytes.NewReader(data),
		))
	}

	if c.DisableBuiltInTelemetry {
		opts = append(opts, alloydbconn.WithOptOutOfBuiltInTelemetry())
	}

	return opts, nil
}