config

package
v0.0.0-...-8a3df02 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: GPL-3.0 Imports: 8 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 {
	LinktlyPrivateKey       string        `required:"true" envconfig:"LINKTLY_PRIVATE_KEY"`
	DBUser                  string        `required:"true" envconfig:"DBUSER"`
	DBHost                  string        `required:"true" envconfig:"DBHOST"`
	DBName                  string        `required:"true" envconfig:"DBNAME"`
	DBPasword               string        `required:"true" envconfig:"DBPASSWORD"`
	ServerAddress           string        `default:"8080" envconfig:"SERVER_ADDRESS"`
	LogLevel                string        `default:"WARN" envconfig:"LOG_LEVEL"`
	LinktlyPublicKey        string        `required:"true" envconfig:"LINKTLY_PUBLIC_KEY"`
	ShutdownGracePeriod     time.Duration `default:"30s" envconfig:"SHUTDOWN_GRACE_PERIOD"`
	WriteTimeout            time.Duration `default:"10s" envconfig:"WRITE_TIMEOUT"`
	DBPort                  int           `required:"true" envconfig:"DBPORT"`
	IdleTimeout             time.Duration `default:"30s" envconfig:"IDLE_TIMEOUT"`
	ReadTimeout             time.Duration `default:"10s" envconfig:"READ_TIMEOUT"`
	AccessTokenExpTime      time.Duration `default:"1h" required:"true" envconfig:"ACCESS_TOKEN_EXP_TIME"`
	RefreshTokenExpTime     time.Duration `default:"120h" required:"true" envconfig:"REFRESH_TOKEN_EXP_TIME"`
	LogHttpRequest          bool          `default:"false" envconfig:"LOG_HTTP_REQUEST"`
	HTTPCookieSecure        bool          `default:"true" envconfig:"HTTP_COOKIE_SECURE"`
	PgPoolMaxConn           int32         `default:"10" envconfig:"PGPOOL_MAX_CONN"`
	PgPoolMinConn           int32         `default:"1" envconfig:"PGPOOL_MIN_CONN"`
	PgPoolConnLifeTime      time.Duration `default:"30m" envconfig:"PGPOOL_CONN_LIFETIME"`
	PgPoolMaxConnIdleTime   time.Duration `default:"10m" envconfig:"PGPOOL_MAX_CONN_IDLE_TIME"`
	PgPoolHealthCheckPeriod time.Duration `default:"1m" envconfig:"PGPOOL_HEALTHCHECK_PERIOD"`
}

func NewConfig

func NewConfig() Config

func (Config) GetDBConnectionString

func (envVar Config) GetDBConnectionString() string

func (Config) GetPrivateKey

func (envVar Config) GetPrivateKey() (*rsa.PrivateKey, error)

func (Config) GetPublicKey

func (envVar Config) GetPublicKey() (*rsa.PublicKey, error)

Jump to

Keyboard shortcuts

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