server

package
v0.1.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbConfig

type DbConfig struct {
	MandatoryPgVersions []int32 `help:"The PostgreSQL versions that must running"`
}

type FileSourceConfig

type FileSourceConfig struct {
	Enabled   bool     `default:"false" negatable:"true" help:"Enable file source"`
	FilePaths []string `validate:"required_if=Enabled true,dive,file|dir" help:"Paths to the source files That declare the databases"`
}

type GrpcConfig

type GrpcConfig struct {
	Tls  TlsConfig       `embed:"" prefix:"tls-" group:"grpc-tls"`
	Auth auth.AuthConfig `embed:"" prefix:"auth-" group:"grpc-auth"`

	Host string `validate:"omitempty,ip" help:"The host that grpc server to listen on"`
	Port int16  `default:"443" help:"The port that grpc server to listen on"`
}

func (*GrpcConfig) ListenOn

func (g *GrpcConfig) ListenOn() string

type ServerConfig

type ServerConfig struct {
	Web    WebConfig    `embed:"" prefix:"web-" group:"web"`
	Grpc   GrpcConfig   `embed:"" prefix:"grpc-" group:"grpc"`
	Db     DbConfig     `embed:"" prefix:"db-" group:"db"`
	Source SourceConfig `embed:"" prefix:"source-" group:"source"`
}

type SourceConfig

type SourceConfig struct {
	File FileSourceConfig `embed:"" prefix:"file-" group:"file-source"`

	DeleyDelete time.Duration `default:"5s"`
}

type TlsConfig

type TlsConfig struct {
	Enabled    bool   `default:"true" negatable:"true" help:"Enable Tls"`
	ServerCert string `validate:"required_if=Enabled true,omitempty,file" help:"Path to the server tls cert"`
	ServerKey  string `validate:"required_if=Enabled true,omitempty,file" help:"Path to the server tls key"`

	MTLSEnabled         bool   `name:"mtls-enabled" negatable:"true" help:"Enable mutual tls"`
	TrustedCA           string `name:"trusted-ca" validate:"required_if=MTLSEnabled true,omitempty,file" help:"Path to the server trusted ca certs"`
	TrustedClientDomain string `validate:"omitempty,fqdn"`
}

func (*TlsConfig) Credentials

func (t *TlsConfig) Credentials() (credentials.TransportCredentials, error)

func (*TlsConfig) TlsConfig

func (t *TlsConfig) TlsConfig() (*tls.Config, error)

type WebConfig

type WebConfig struct {
	Enabled        bool     `default:"false" help:"Enable the web server"`
	UseH2C         bool     `name:"use-h2c" default:"true" negatable:"true" help:"Enable http/2 without TLS"`
	TrustedProxies []string `help:"Addresses of the trusted proxies"`

	Tls  TlsConfig       `embed:"" prefix:"tls-" group:"web-tls"`
	Auth auth.AuthConfig `embed:"" prefix:"auth-" help:"Auth config" group:"web-auth"`
}

func (*WebConfig) ListenOn

func (c *WebConfig) ListenOn() string

Jump to

Keyboard shortcuts

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