config

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

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

Go to latest
Published: Oct 6, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DatabaseMigrationTable = "migrations"

The DatabaseMigrationTable name is baked into the binary This setting should always be in sync with dbconfig.yml, sqlboiler.toml and the live database (e.g. to be able to test producation dumps locally)

Variables

View Source
var DatabaseMigrationFolder = filepath.Join(util.GetProjectRootDir(), "/migrations")

The DatabaseMigrationFolder (folder with all *.sql migrations). This settings should always be in sync with dbconfig.yaml and Dockerfile (the final app stage). It's expected that the migrations folder lives at the root of this project or right next to the app binary.

Functions

This section is empty.

Types

type AuthServer

type AuthServer struct {
	AccessTokenValidity                time.Duration
	RefreshTokenValidity               time.Duration
	PasswordResetTokenValidity         time.Duration
	PasswordResetTokenDebounceDuration time.Duration
	PasswordResetTokenReuseDuration    time.Duration
	DefaultUserScopes                  []string
	LastAuthenticatedAtThreshold       time.Duration
}

type Database

type Database struct {
	Host             string
	Port             int
	Username         string
	Password         string `json:"-"` // sensitive
	Database         string
	AdditionalParams map[string]string `json:",omitempty"` // Optional additional connection parameters mapped into the connection string
	MaxOpenConns     int
	MaxIdleConns     int
	ConnMaxLifetime  time.Duration
}

func (Database) ConnectionString

func (c Database) ConnectionString() string

ConnectionString generates a connection string to be passed to sql.Open or equivalents, assuming Postgres syntax

type EchoServer

type EchoServer struct {
	Debug                          bool
	ListenAddress                  string
	HideInternalServerErrorDetails bool
	BaseURL                        string
	EnableCORSMiddleware           bool
	EnableLoggerMiddleware         bool
	EnableRecoverMiddleware        bool
	EnableRequestIDMiddleware      bool
	EnableTrailingSlashMiddleware  bool
	EnableSecureMiddleware         bool
	EnableCacheControlMiddleware   bool
	SecureMiddleware               EchoServerSecureMiddleware
}

type EchoServerSecureMiddleware

type EchoServerSecureMiddleware struct {
	XSSProtection         string
	ContentTypeNosniff    string
	XFrameOptions         string
	HSTSMaxAge            int
	HSTSExcludeSubdomains bool
	ContentSecurityPolicy string
	CSPReportOnly         bool
	HSTSPreloadEnabled    bool
	ReferrerPolicy        string
}

EchoServerSecureMiddleware represents a subset of echo's secure middleware config relevant to the app server. https://github.com/labstack/echo/blob/master/middleware/secure.go

type LoggerServer

type LoggerServer struct {
	Level              zerolog.Level
	RequestLevel       zerolog.Level
	LogRequestBody     bool
	LogRequestHeader   bool
	LogRequestQuery    bool
	LogResponseBody    bool
	LogResponseHeader  bool
	LogCaller          bool
	PrettyPrintConsole bool
}

type Server

type Server struct {
	Database Database
	Echo     EchoServer
	Auth     AuthServer
	Logger   LoggerServer
}

func DefaultServiceConfigFromEnv

func DefaultServiceConfigFromEnv() Server

Jump to

Keyboard shortcuts

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