config

package
v0.0.0-...-904661e Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FilledDefaultConfig = Config{
	AllowedOrigins:       []string{},
	ClusterURI:           "qdb://127.0.0.1:2836",
	ClusterPublicKeyFile: "",
	RestPrivateKeyFile:   "",
	ReadinessQuery:       "",
	TLSCertificate:       "",
	TLSCertificateKey:    "",
	TLSPort:              40443,
	Host:                 "localhost",
	Port:                 40080,
	Log:                  "/var/log/qdb/qdb_rest.log",
	Assets:               "/var/lib/qdb/assets",
	MaxInBufferSize:      131072000,
	ParallelismCount:     1,
	PoolSize:             1,
}

FilledDefaultConfig for unix

View Source
var Local = Config{
	Host:   "localhost",
	Port:   40080,
	Log:    "qdb_rest.log",
	Assets: "assets",
}

Local config

View Source
var Secured = Config{
	ClusterPublicKeyFile: "/usr/share/qdb/cluster_public.key",
	RestPrivateKeyFile:   "/etc/qdb/qdb_rest_private.key",
	TLSCertificate:       "/etc/qdb/qdb_rest.cert.pem",
	TLSCertificateKey:    "/etc/qdb/qdb_rest.key.pem",
	TLSPort:              40443,
}

Secured config

Functions

func Generate

func Generate(defConfig Config) bool

Generate a configuration file if needed

Types

type Config

type Config struct {
	AllowedOrigins       []string       `json:"allowed_origins" long:"allowed-origins" description:"Allowed origins for cross origins"`
	ClusterURI           string         `json:"cluster_uri" short:"c" long:"cluster" description:"URI of the cluster we connect to" env:"QDB_CLUSTER_URI"`
	ClusterPublicKeyFile flags.Filename `` /* 144-byte string literal not displayed */
	RestPrivateKeyFile   flags.Filename `` /* 138-byte string literal not displayed */
	ReadinessQuery       string         `json:"readiness_query" long:"readiness-query" description:"Query used to check cluster readiness" env:"QDB_READINESS_QUERY"`
	TLSCertificate       flags.Filename `` /* 127-byte string literal not displayed */
	TLSCertificateKey    flags.Filename `json:"tls_key" long:"tls-key" description:"The private key to use for secure conections" env:"TLS_PRIVATE_KEY"`
	TLSPort              int            `json:"tls_port" long:"tls-port" description:"The port to listen on for secure connections" env:"TLS_PORT"`
	Host                 string         `json:"host" long:"host" description:"The IP to listen on" default:"localhost" env:"HOST"`
	Port                 int            `json:"port" long:"port" description:"The port to listen on for insecure connections, defaults to a random value" env:"PORT"`
	Log                  flags.Filename `json:"log" long:"log-file" description:"The path to the log file" env:"QDB_REST_LOG_FILE"`
	Assets               string         `` /* 152-byte string literal not displayed */
	MaxInBufferSize      uint           `` /* 147-byte string literal not displayed */
	ParallelismCount     uint           `` /* 132-byte string literal not displayed */
	PoolSize             uint           `json:"pool_size" long:"pool-size" description:"The number of connections allowed per user" env:"QDB_POOL_SIZE"`

	ConfigFile  flags.Filename `json:"-" long:"config-file" description:"Config file to setup the rest api"`
	GenConfig   bool           `json:"-" long:"gen-config" description:"Generate a config"`
	Interactive bool           `` /* 132-byte string literal not displayed */
	Local       bool           `json:"-" short:"l" long:"local" description:"Switch on local mode"`
	Secure      bool           `json:"-" short:"s" long:"secure" description:"Switch on security default parameters (tls + cluster security)"`
}

Config : A configuration file for the rest api

func (*Config) Check

func (c *Config) Check() error

Check : check the configuration to test for basic security features

func (*Config) IsSecurityEnabled

func (c *Config) IsSecurityEnabled() bool

IsSecurityEnabled returns true when the cluster security is enabled

func (Config) Print

func (c Config) Print()

Print the configuration

func (*Config) SetDefaults

func (c *Config) SetDefaults()

SetDefaults : set defaults values if there are no config values

func (*Config) SetLocal

func (c *Config) SetLocal()

SetLocal set config to local mode

func (*Config) SetSecured

func (c *Config) SetSecured()

SetSecured set config to secured mode

Jump to

Keyboard shortcuts

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