config

package
v0.0.0-...-ccde487 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMicroserviceName

func GetMicroserviceName(serviceName string) string

func InitConfig

func InitConfig() (*Config, *LoggerConfig, *echoserver.EchoConfig, error)

func InitLogger

func InitLogger(cfg *LoggerConfig) logger.ILogger

InitLogger Init logger

Types

type Config

type Config struct {
	ServiceName string                 `mapstructure:"service-name"`
	Logger      *LoggerConfig          `mapstructure:"logger"`
	Echo        *echoserver.EchoConfig `mapstructure:"echo"`
}

type Context

type Context struct {
	Timeout int `mapstructure:"timeout"`
}

type DatabaseConfig

type DatabaseConfig struct {
	Type         string
	Host         string
	Port         int
	User         string
	Password     string
	DatabaseName string
	MaxIdleConns int
	MaxOpenConns int
}

DatabaseConfig stores database connection options

type LoggerConfig

type LoggerConfig struct {
	LogLevel string `mapstructure:"level"`
}

type OauthConfig

type OauthConfig struct {
	AccessTokenLifetime  int
	RefreshTokenLifetime int
	AuthCodeLifetime     int
}

OauthConfig stores oauth service configuration options

type SessionConfig

type SessionConfig struct {
	Secret string
	Path   string
	// MaxAge=0 means no 'Max-Age' attribute specified.
	// MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'.
	// MaxAge>0 means Max-Age attribute present and given in seconds.
	MaxAge int
	// When you tag a cookie with the HttpOnly flag, it tells the browser that
	// this particular cookie should only be accessed by the server.
	// Any attempt to access the cookie from client script is strictly forbidden.
	HTTPOnly bool
}

SessionConfig stores session configuration for the web app

Jump to

Keyboard shortcuts

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