config

package
v0.18.0-beta02 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package config contains utils and structure to load Prisme configurations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvOrDefault

func GetEnvOrDefault(name string, defaultValue string) string

GetEnvOrDefault reads environment variable with the given name and return it. If variable is not set, defaultValue is returned.

func MustGetEnv

func MustGetEnv(name string) string

MustGetEnv reads environment variable with the given name and return it. If variable is not set, this function panics.

func MustParseUrlEnv

func MustParseUrlEnv(name string) *url.URL

MustParseUrlEnv reads and environment variable with the given name and parses it as an URL. If variable is not set, this function panics. If variable value is not a valid URL, this function panics.

func ParseDurationEnvOrDefault

func ParseDurationEnvOrDefault(name string, defaultValue time.Duration) time.Duration

ParseUintEnvOrDefault reads environment variable with the given name and parses it as a duration. If variable is not set, defaultValue is returned. If variable value is not a valid duration, this function panics.

func ParseIntEnvOrDefault

func ParseIntEnvOrDefault(name string, defaultValue int64, bitSize int) int64

ParseIntEnvOrDefault reads environment variable with the given name and parses it as an signed integer. If variable is not set, defaultValue is returned. If variable value is not a valid signed integer, this function panics.

func ParseUintEnvOrDefault

func ParseUintEnvOrDefault(name string, defaultValue uint64, bitSize int) uint64

ParseUintEnvOrDefault reads environment variable with the given name and parses it as an unsigned integer. If variable is not set, defaultValue is returned. If variable value is not a valid unsigned integer, this function panics.

Types

type Clickhouse

type Clickhouse struct {
	TlsEnabled bool
	HostPort   string
	Database   string
	User       secrecy.SecretString
	Password   secrecy.SecretString
}

Clickhouse connection options.

func ClickhouseFromEnv

func ClickhouseFromEnv() Clickhouse

ClickhouseFromEnv loads clickhouse config from environment variables. This function panics if required environment variables are missing.

type Grafana

type Grafana struct {
	Url      string
	User     secrecy.SecretString
	Password secrecy.SecretString
	OrgId    int64
}

Grafana related options.

func GrafanaFromEnv

func GrafanaFromEnv() Grafana

GrafanaFromEnv loads grafana related options from environment variables. This function panics if required environment variables are missing.

type Server

type Server struct {
	// Access log file path.
	AccessLog string
	// Sets log level to debug.
	Debug bool
	// Listening port.
	Port uint16
	// Trust proxy headers.
	TrustProxy bool
	// X-Forwarded-For proxy header.
	ProxyHeader string
	// host:port address of admin http server.
	AdminHostPort string
	// Timeout for /api/v1/events/* handlers.
	ApiEventsTimeout time.Duration
}

Server specific options.

func ServerFromEnv

func ServerFromEnv() Server

ServerFromEnv loads server related options from environment variables.

Jump to

Keyboard shortcuts

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