config

package
v0.0.0-...-eb5cc7f Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Project     *ProjectConfiguration     `yaml:"project"`
	GRPC        *EndpointConfiguration    `yaml:"grpc"`
	Gateway     *EndpointConfiguration    `yaml:"gateway"`
	Database    *DatabaseConfiguration    `yaml:"database"`
	ChunkSize   int                       `yaml:"chunkSize"`
	Jaeger      *EndpointConfiguration    `yaml:"jaeger"`
	Kafka       *KafkaConfiguration       `yaml:"kafka"`
	Prometheus  *PrometheusConfiguration  `yaml:"prometheus"`
	HealthCheck *HealthCheckConfiguration `yaml:"health_check"`
}

Configuration type represents application configuration

func (*Configuration) LoadConfigurationFromFile

func (c *Configuration) LoadConfigurationFromFile(path string) (conf Configuration, err error)

LoadConfigurationFromFile - method for load Configuration from JSON file. The method return empty Configuration if any error occur in loading process.

type ConfigurationUpdater

type ConfigurationUpdater struct {
	// contains filtered or unexported fields
}

ConfigurationUpdater type represents object for check Configuration updates in JSON file.

func NewConfigurationUpdater

func NewConfigurationUpdater(updatePeriodicity time.Duration, configurationFilePath string) *ConfigurationUpdater

NewConfigurationUpdater - create ConfigurationUpdater object for check Configuration updates in JSON file. For run periodic checking of JSON configuration file use ConfigurationUpdater.WatchConfigurationFile. UpdatePeriodicity - time period between repeatable reads of configuration file. ConfigurationFilePath - path to JSON file with app configuration.

func (*ConfigurationUpdater) GetConfiguration

func (cu *ConfigurationUpdater) GetConfiguration() *Configuration

GetConfiguration - get actual configuration

func (*ConfigurationUpdater) UnWatchConfigurationFile

func (cu *ConfigurationUpdater) UnWatchConfigurationFile()

UnWatchConfigurationFile - stop infinite task, checking updates in configuration file

func (*ConfigurationUpdater) WatchConfigurationFile

func (cu *ConfigurationUpdater) WatchConfigurationFile(configurationUpdateHandler func(conf Configuration))

WatchConfigurationFile - run infinite task, checking updates in configuration file

type DatabaseConfiguration

type DatabaseConfiguration struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
	Name     string `yaml:"name"`
	SslMode  string `yaml:"sslMode"`
	Driver   string `yaml:"driver"`
}

DatabaseConfiguration type represents configuration with information connection parameters to database

func (DatabaseConfiguration) GetDataSourceName

func (configuration DatabaseConfiguration) GetDataSourceName() string

GetDataSourceName - return dataSourceName in format "host=%v port=%v dbname=%v user=%v password=%v sslmode=%v"

type EndpointConfiguration

type EndpointConfiguration struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

EndpointConfiguration type represents configuration for network endpoint (host and port)

func (*EndpointConfiguration) GetEndpointAddress

func (c *EndpointConfiguration) GetEndpointAddress() string

GetEndpointAddress - returns string in format "hostname:port" for endpoint

type HealthCheckConfiguration

type HealthCheckConfiguration struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
	Path string `yaml:"path"`
}

HealthCheckConfiguration type represents configuration for handler to HealthCheck

func (*HealthCheckConfiguration) GetEndpointAddress

func (c *HealthCheckConfiguration) GetEndpointAddress() string

GetEndpointAddress - returns string in format "hostname:port" for endpoint

type KafkaConfiguration

type KafkaConfiguration struct {
	Topic   string   `yaml:"topic"`
	Brokers []string `yaml:"brokers"`
}

KafkaConfiguration type represents configuration for Kafka

type ProjectConfiguration

type ProjectConfiguration struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
}

ProjectConfiguration type represents configuration with information about project

type PrometheusConfiguration

type PrometheusConfiguration struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
	Path string `yaml:"path"`
}

PrometheusConfiguration type represents configuration for handler to prometheus

func (*PrometheusConfiguration) GetEndpointAddress

func (c *PrometheusConfiguration) GetEndpointAddress() string

GetEndpointAddress - returns string in format "hostname:port" for endpoint

Jump to

Keyboard shortcuts

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