rzcfg

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: MIT Imports: 28 Imported by: 0

README

rzcfg

Documentation

Index

Constants

View Source
const (
	UUIDEvent                string = "UUID_EVENT"
	UpdateConfigurationEvent string = "UPDATE_CONFIGURATION_EVENT"
)

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(configFilePath string, prefix string, v interface{}) error

Types

type Callback

type Callback func(context.Context, Event, interface{})

type Client

type Client interface {
	Init(context.Context, interface{}) error
	Register(string, Callback)
}

func NewConfigDBClient

func NewConfigDBClient(cfg *DynamodbDBCfg, sess *session.Session, opts ...Option) (Client, error)

func NewConfigServerClient

func NewConfigServerClient(cfg *ServerCfg, opts ...Option) (Client, error)

type DynamodbDBCfg

type DynamodbDBCfg struct {
	Table                       string            `json:"config_dynamodb_table" envconfig:"CONFIG_DYNAMODB_TABLE" required:"true"`
	AppName                     string            `json:"app_name" envconfig:"APP_NAME" required:"true" default:""`
	Env                         string            `json:"env" envconfig:"ENV" required:"true" default:"dev"`
	Version                     int64             `json:"version" envconfig:"VERSION" required:"true"`
	SecretsManager              SecretsManagerCfg `json:"secrets_manager" envconfig:"SECRETS_MANAGER"`
	RequestTimeoutInMillisecond int64             `` /* 141-byte string literal not displayed */
}

type Event

type Event struct {
	EventType string `json:"event_type"`
	Timestamp int64  `json:"timestamp"`
}

type GeneralConfigServerError

type GeneralConfigServerError struct {
	*rzerrors.RZError
	*rzerrors.ErrorWithID
}

func NewGeneralConfigServerError

func NewGeneralConfigServerError(code, msg string) *GeneralConfigServerError

func (*GeneralConfigServerError) Wrap

type Option

type Option func(o *Options)

Option optional parameter as function

func WithLogger

func WithLogger(log rzlog.Logger) Option

func WithSecretsManager

func WithSecretsManager(secretsManager *secretsmanager.SecretsManager) Option

type Options

type Options struct {
	Context context.Context
}

Options struct to keep all parameters in context.Context

func NewOptions

func NewOptions(opts ...Option) Options

NewOptions convert all Option function to Options struct

type SecretsManagerCfg

type SecretsManagerCfg struct {
	SecretID     string `mapstructure:"secret_id" json:"secret_id" envconfig:"SECRET_ID"`
	VersionStage string `mapstructure:"version_stage" json:"version_stage" envconfig:"VERSION_STAGE" default:"AWSCURRENT"`
}

type ServerCfg

type ServerCfg struct {
	ServerAddress                 string            `` /* 140-byte string literal not displayed */
	AppName                       string            `mapstructure:"app_name" json:"app_name" envconfig:"APP_NAME" required:"true" default:""`
	Env                           string            `mapstructure:"env" json:"env" envconfig:"ENV" required:"true" default:"dev"`
	SecretsManager                SecretsManagerCfg `mapstructure:"secrets_manager" json:"secrets_manager" envconfig:"SECRETS_MANAGER"`
	IsSecure                      bool              `mapstructure:"is_secure" json:"is_secure" envconfig:"IS_SECURE" default:"true"`
	EnableAutoReconnect           bool              `mapstructure:"enable_auto_reconnect" json:"enable_auto_reconnect" envconfig:"ENABLE_AUTO_RECONNECT" default:"true"`
	DialTimeoutInMillisecond      int64             `` /* 132-byte string literal not displayed */
	ReconnectBackoffInMillisecond int64             `` /* 147-byte string literal not displayed */
	RequestTimeoutInMillisecond   int64             `` /* 141-byte string literal not displayed */
}

Directories

Path Synopsis
protopb

Jump to

Keyboard shortcuts

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