config

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Environments = map[string]string{
	"local":      "local",
	"staging":    "staging",
	"production": "production",
}

Functions

func Get added in v0.0.9

func Get(path, file, env, configType string, cfg interface{}) error

func GetCustomForDefaultPath added in v0.0.10

func GetCustomForDefaultPath(configType string, cfg interface{}) error

func GetWithAbsolutePath added in v0.0.9

func GetWithAbsolutePath(path, file, configType string, cfg interface{}, notifier Notify) error

func LookupEnvOrDefault added in v0.0.10

func LookupEnvOrDefault(key string, defaultVal string) string

Types

type DefaultConfig added in v0.0.7

type DefaultConfig struct {
	Service Service
	HTTP    HTTP
	GRPC    GRPC
	Tracing Tracing
	Metrics Metrics
	SqlDB   SQLDB
	NoSqlDB NOSQLDB
}

func GetDefault added in v0.0.9

func GetDefault() (DefaultConfig, error)

type GRPC

type GRPC struct {
	Host            string
	Port            string
	ReadTimeout     time.Duration
	WriteTimeout    time.Duration
	ShutdownTimeout time.Duration
}

type GRPCClient

type GRPCClient struct {
	Host     string
	Port     string
	TLS      bool
	Insecure bool
}

type HTTP added in v0.0.7

type HTTP struct {
	Host            string
	Port            string
	ReadTimeout     time.Duration
	WriteTimeout    time.Duration
	ShutdownTimeout time.Duration
}

type Kafka added in v0.0.7

type Kafka struct {
	TopicPrefix string
	Broker      string
	Key         MaskedString
	Secret      MaskedString
}

type MaskedString added in v0.0.7

type MaskedString string

func (MaskedString) MarshalJSON added in v0.0.7

func (s MaskedString) MarshalJSON() ([]byte, error)

func (MaskedString) String added in v0.0.7

func (s MaskedString) String() string

String implements the fmt.Stringer interface.

func (MaskedString) Unmask added in v0.0.7

func (s MaskedString) Unmask() string

type Metrics added in v0.0.7

type Metrics struct {
	Name     string
	Endpoint string
	Port     string
}

type NOSQLDB added in v0.0.7

type NOSQLDB struct {
	User     string
	Password MaskedString
	Scheme   string // `mongodb://` or `mongodb+srv://`
	Host     string
	Port     string
	Database string
}

type Notify added in v0.0.9

type Notify func(description string)

type SQLDB added in v0.0.7

type SQLDB struct {
	User     string
	Password MaskedString
	Host     string
	Port     string
	Database string
}

type Service added in v0.0.7

type Service struct {
	Name           string
	SandboxEnabled bool
	TracingEnabled bool
}

type Tracing added in v0.0.7

type Tracing struct {
	Name     string
	Endpoint string
	Port     string
}

Jump to

Keyboard shortcuts

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