sharedconfig

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// LoggerLevel: info, debug, warning, error, fatal, panic.
	LoggerLevel string `envconfig:"LOGGER_LEVEL"  default:"debug"`
	// LoggerLevel: /dev/null/, stdout, stderr, or filename (logs will store in the {projectRoot}/var/log dir.).
	LoggerOutput string `envconfig:"LOGGER_OUTPUT" default:"stdout"`
	// LoggerFormatter: text, json.
	LoggerFormatter string `envconfig:"LOGGER_FORMAT" default:"json"`
	// LoggerContextExtraFields determines which fields must be extract from
	// context.Context and passed into log record (see more into ctxenum package).
	LoggerContextExtraFields []string `envconfig:"LOGGER_CONTEXT_EXTRA_FIELD" default:"jobId,taskId"`

	// MongoHost is a host from docker-compose (mongodb container name).
	MongoHost string `envconfig:"MONGO_HOST" default:"mongodb"`
	// MongoPort is an exposed port of mongodb.
	MongoPort int `envconfig:"MONGO_PORT" default:"27017"`
	// MongoLogin is a login for simple auth.
	MongoLogin string `envconfig:"MONGO_LOGIN" default:"spider"`
	// MongoPassword is a password for simple auth.
	MongoPassword string `envconfig:"MONGO_PASSWORD" default:"spider"`
	// MongoDatabase is a name of target mongodb.
	MongoDatabase string `envconfig:"MONGO_DATABASE" default:"spider"`
	// MongoRequestTimeout is a timeout per request to mongodb.
	MongoRequestTimeout time.Duration `envconfig:"MONGO_REQUEST_TIMEOUT" default:"5s"`

	// InfrastructureServerName is a name of the shared server.
	InfrastructureServerName string `envconfig:"INFRASTRUCTURE_SERVER_NAME" default:"infrastructure"`
	// InfrastructureServerPort is a port for shared server (endpoints like a /probe for k8s).
	InfrastructureServerPort string `envconfig:"INFRASTRUCTURE_SERVER_PORT" default:":8000"`
	// InfrastructureServerShutDownTimeout is a duration value before the server will be closed forcefully.
	InfrastructureServerShutDownTimeout time.Duration `envconfig:"INFRASTRUCTURE_SERVER_SHUTDOWN_TIMEOUT" default:"5s"`
	// InfrastructureServerRequestTimeout is a timeout value for close request forcefully.
	InfrastructureServerRequestTimeout time.Duration `envconfig:"INFRASTRUCTURE_SERVER_REQUEST_TIMEOUT" default:"1m"`
}

func Load

func Load() (*Config, error)

func (*Config) GetLoggerContextExtraFields

func (c *Config) GetLoggerContextExtraFields() []string

func (*Config) GetLoggerFormatter

func (c *Config) GetLoggerFormatter() string

func (*Config) GetLoggerLevel

func (c *Config) GetLoggerLevel() string

func (*Config) GetLoggerOutput

func (c *Config) GetLoggerOutput() string

func (*Config) GetMongoDatabase

func (c *Config) GetMongoDatabase() string

func (*Config) GetMongoHost

func (c *Config) GetMongoHost() string

func (*Config) GetMongoLogin

func (c *Config) GetMongoLogin() string

func (*Config) GetMongoPassword

func (c *Config) GetMongoPassword() string

func (*Config) GetMongoPort

func (c *Config) GetMongoPort() int

func (*Config) GetServerName

func (c *Config) GetServerName() string

func (*Config) GetServerPort

func (c *Config) GetServerPort() string

func (*Config) GetServerRequestTimeout

func (c *Config) GetServerRequestTimeout() time.Duration

func (*Config) GetServerShutDownTimeout

func (c *Config) GetServerShutDownTimeout() time.Duration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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