Exemplo n.º 1
0
func (m *Meta) WriteOptions() *consulapi.WriteOptions {
	writeOpts := new(consulapi.WriteOptions)

	if os.Getenv("CONSUL_TOKEN") != "" {
		writeOpts.Token = os.Getenv("CONSUL_TOKEN")
	}

	if m.token != "" {
		writeOpts.Token = m.token
	}

	if m.dc != "" {
		writeOpts.Datacenter = m.dc
	}

	return writeOpts
}
Exemplo n.º 2
0
func (m *Meta) WriteOptions() *consulapi.WriteOptions {
	writeOpts := new(consulapi.WriteOptions)
	if m.token != "" {
		writeOpts.Token = m.token
	}

	if m.dc != "" {
		writeOpts.Datacenter = m.dc
	}

	return writeOpts
}
Exemplo n.º 3
0
func (c *Cmd) WriteOptions() *consulapi.WriteOptions {
	csl := c.consul

	writeOpts := new(consulapi.WriteOptions)
	if csl.token != "" {
		writeOpts.Token = csl.token
	}

	if csl.dc != "" {
		writeOpts.Datacenter = csl.dc
	}

	return writeOpts
}