config

package
v0.0.0-...-90cfb48 Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENV_PORT                  = "PORT"
	ENV_CONSUL_HOST           = "CONSUL_HOST"
	ENV_CONSUL_KEY_FOLDER     = "CONSUL_KEY_FOLDER"
	ENV_CONSUL_KEY_VERSION    = "CONSUL_KEY_VERSION"
	ENV_CONSUL_KEY_FILE       = "CONSUL_KEY_FILE"
	ENV_VAULT_SCHEME          = "VAULT_SCHEME"
	ENV_VAULT_HOST            = "VAULT_HOST"
	ENV_VAULT_TOKEN           = "VAULT_TOKEN"
	ENV_VAULT_MOUNT_PATH      = "VAULT_MOUNT_PATH"
	ENV_VAULT_PUBLIC_KEY_PATH = "VAULT_PUBLIC_KEY_PATH"
	ENV_AUTH_HOST             = "AUTH_HOST"
)

Variables

This section is empty.

Functions

func NewVaultClient

func NewVaultClient(env *VaultConfig) (*vault.Client, error)

func ReadConfig

func ReadConfig(name string, dest any) error

func ReadConsulConfig

func ReadConsulConfig(env *ConsulConfig, dest any) error

func VaultPublicKey

func VaultPublicKey(vc *vault.Client, env *VaultConfig) ([]byte, error)

Types

type Config

type Config struct {
	DB DBConfig `yaml:"db"`
}

type ConsulConfig

type ConsulConfig struct {
	Host string          `yaml:"host"`
	Key  ConsulConfigKey `yaml:"key"`
}

type ConsulConfigKey

type ConsulConfigKey struct {
	Folder  string `yaml:"folder"`
	Version string `yaml:"version"`
	File    string `yaml:"file"`
}

func (*ConsulConfigKey) String

func (cc *ConsulConfigKey) String() string

type DBConfig

type DBConfig struct {
	Port     int    `yaml:"port"`
	Host     string `yaml:"host"`
	Password string `yaml:"password"`
	User     string `yaml:"user"`
	Sslmode  string `yaml:"sslmode"`
	DBName   string `yaml:"dbname"`
}

type EnvConfig

type EnvConfig struct {
	Vault    VaultConfig  `yaml:"vault"`
	Consul   ConsulConfig `yaml:"consul"`
	AuthHost string       `yaml:"auth_host"`
	Port     string       `yaml:"port"`
}

func ReadEnv

func ReadEnv() (*EnvConfig, error)

type VaultConfig

type VaultConfig struct {
	Scheme        string `yaml:"scheme"`
	Host          string `yaml:"host"`
	Token         string `yaml:"token"`
	MountPath     string `yaml:"mount_path"`
	PublicKeyPath string `yaml:"public_key_path"`
}

Jump to

Keyboard shortcuts

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