consul

package module
v0.0.0-...-0885add Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2022 License: MIT Imports: 5 Imported by: 0

README

consul

consul config

Example
package consul

import (
	"fmt"
	"os"
	"testing"
)

func TestConfig(t *testing.T) {
	consul := new(Consul)
	consul.Host = os.Getenv("CONSUL_HOST")
	consul.Port = os.Getenv("CONSUL_PORT")
	consul.Stage = os.Getenv("STAGE")
	consul.ServiceName = os.Getenv("CONSUL_SERVICE")
	consul.TokenPath = os.Getenv("CONSUL_SECRET_TOKEN")
	consul.ConfigAddress = consul.Address()
	consul.ConfigPath = consul.Path()
	consul.TokenKey = consul.Token()

	config := consul.Config()
	t.Log(fmt.Sprintf("Config %s", config))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consul

type Consul struct {
	Host, Port, Stage, ServiceName, TokenKey, ConfigAddress, ConfigPath, TokenPath string
}

func (*Consul) Address

func (consul *Consul) Address() string

func (*Consul) Config

func (consul *Consul) Config() []byte

func (*Consul) Path

func (consul *Consul) Path() string

func (*Consul) Token

func (consul *Consul) Token() string

type TokenKey

type TokenKey struct {
	Token string `yaml:"token"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL