config

package
v0.0.0-...-98da78b Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: Apache-2.0 Imports: 3 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 {
	Server
	Cors
	Secure
	Database
	Jwt
}

func New

func New() *Config

type Cors

type Cors struct {
	AllowedOrigins   []string `split_words:"true" required:"true"`
	AllowedMethods   []string `split_words:"true" default:"GET,POST,PUT,DELETE,PATCH,OPTIONS"`
	AllowedHeaders   []string `` /* 168-byte string literal not displayed */
	AllowCredentials bool     `split_words:"true" default:"true"`
	MaxAge           int      `split_words:"true" default:"300"`
}

type Database

type Database struct {
	Url               string        `required:"true"`
	SslMode           string        `default:"disable"`
	PoolMax           int32         `split_words:"true" default:"5"`
	PoolMin           int32         `split_words:"true" default:"0"`
	ConnectTimeout    time.Duration `split_words:"true" default:"10s"`
	MaxConnLifetime   time.Duration `split_words:"true" default:"60m"`
	MaxConnIdleTime   time.Duration `split_words:"true" default:"30m"`
	HealthCheckPeriod time.Duration `split_words:"true" default:"60s"`
	TimeZone          string        `split_words:"true" default:"UTC"`
}

type Jwt

type Jwt struct {
	JwtPubKeyPath string `split_words:"true" required:"true"`
	JwtPvtKeyPath string `split_words:"true" required:"true"`
}

type Secure

type Secure struct {
	AllowedHosts          []string          `split_words:"true" default:"localhost"`
	AllowedHostsAreRegex  bool              `split_words:"true" default:"false"`
	HostsProxyHeaders     []string          `split_words:"true" default:"X-Forwarded-Host"`
	SSLRedirect           bool              `split_words:"true" default:"true"`
	SSLHost               string            `split_words:"true" default:"localhost"`
	STSSeconds            int64             `split_words:"true" default:"31536000"`
	STSIncludeSubdomains  bool              `split_words:"true" default:"true"`
	STSPreload            bool              `split_words:"true" default:"true"`
	FrameDeny             bool              `split_words:"true" default:"true"`
	ContentTypeNosniff    bool              `split_words:"true" default:"true"`
	BrowserXssFilter      bool              `split_words:"true" default:"true"`
	ContentSecurityPolicy string            `split_words:"true" default:"script-src $NONCE"`
	SSLProxyHeaders       map[string]string `split_words:"true" default:"X-Forwarded-Proto:https"`
}

type Server

type Server struct {
	AppEnv       string        `default:"development"`
	Name         string        `default:"go-api"`
	Host         string        `default:"0.0.0.0"`
	Port         int           `default:"3000"`
	Logging      bool          `default:"true"`
	IdleTimeout  time.Duration `split_words:"true" default:"60s"`
	ReadTimeout  time.Duration `split_words:"true" default:"5s"`
	WriteTimeout time.Duration `split_words:"true" default:"10s"`
	TLSCertPath  string        `split_words:"true" required:"true"`
	TLSKeyPath   string        `split_words:"true" required:"true"`
}

Jump to

Keyboard shortcuts

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