config

package
v4.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 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 Authorization

type Authorization struct {
	// HeaderName is the name of the header where the authorization middleware is supposed
	// to be looking for a JWT token
	HeaderName string `json:"headerName"`
}

Authorization contains all the authorization-related parameters

type Database

type Database struct {
	// Host of the database server
	Host string `json:"host"`
	// Port of the database server, if empty, we will attempt to parse the port from the host value,
	// if Host does not have a port value, then we will use the default value from the db driver
	Port uint32 `json:"port"`
	// Name is the name of the database on the host
	Name string `json:"name"`
	// Username to access the database
	Username string `json:"username"`
	// PasswordPath is a path to the file where the password is stored
	PasswordPath string `json:"passwordPath"`
	// PoolSize is the max number of concurrent connections to the database,
	// <=0 is unlimited
	PoolSize int `json:"poolSize"`
	// DriverName is the database driver name e.g. postgres
	DriverName string `json:"driverName"`
}

Database contains all the configuration parameters for a database

func (*Database) GetConnectionString

func (cfg *Database) GetConnectionString() (connStr string, err error)

GetConnectionString returns the formed connection string

func (*Database) GetHost

func (cfg *Database) GetHost() string

GetHost returns the host name of the underlying db

func (*Database) GetPassword

func (cfg *Database) GetPassword() (string, error)

GetPassword gets the database password from PasswordPath

func (*Database) GetPort

func (cfg *Database) GetPort() uint32

GetPort returns the port of the underlying db

type HTTP

type HTTP struct {
	// Address to listen for the HTTP server
	Address string `json:"address"`
}

HTTP contains all configuration parameters for HTTP

type JWT

type JWT struct {
	// PublicKeyPath is a path to the public key for JWT signature verification
	PublicKeyPath string `json:"publicKeyPath"`
	// PrivateKeyPath is a path to the private key for signing JWT
	PrivateKeyPath string `json:"privateKeyPath"`
}

JWT contains all JWT related parameters

func (*JWT) GetPrivateKey

func (j *JWT) GetPrivateKey() (privateKey *rsa.PrivateKey, err error)

GetPrivateKey gets the encryption key from a given path

func (*JWT) GetPublicKey

func (j *JWT) GetPublicKey() (publicKey *rsa.PublicKey, err error)

GetPublicKey gets the encryption key from a given path

type Queue

type Queue struct {
	// HeartbeatTTL is the max time a worker is expected to call queue.Heartbeat when processing a task
	HeartbeatTTL time.Duration `json:"heartbeatTTL"`
	// PollFrequency is the polling frequency when the queue will check for a new task for a waiting worker
	PollFrequency time.Duration `json:"pollFrequency"`
	// JobSchedulingInterval is the interval between iterations of the worker (e.g. job scheduling)
	SchedulingInterval time.Duration `json:"schedulingInterval"`
	// Minimal time between two listener reconnects
	MinReconnectTimeout time.Duration `json:"minReconnectTimeout"`
	// Maximal time between two listener reconnects
	MaxReconnectTimeout time.Duration `json:"maxReconnectTimeout"`
}

Queue contains configuation for task queueing

Jump to

Keyboard shortcuts

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