config

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

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

Go to latest
Published: Feb 1, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvPrefix         = "MO"
	MonitorablePrefix = "MONITORABLE"
	ConfigPrefix      = "CONFIG"

	DefaultConfigName ConfigName = "default"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigName

type ConfigName string

type CoreConfig

type CoreConfig struct {
	// --- General Configuration ---
	Port      int
	Address   string
	DisableUI bool

	// --- Cache Configuration ---
	// UpstreamCacheExpiration is used to respond before executing the request. Avoid overloading services.
	UpstreamCacheExpiration int
	// DownstreamCacheExpiration is used to respond after executing the request in case of timeout error.
	DownstreamCacheExpiration int

	// InitialMaxDelay is used to add delay on first method to avoid bursting x requests in same time on start
	InitialMaxDelay int // in Millisecond

	// NamedConfig can contains ui config (path or url)
	// Can contains default or named config file
	// Like:
	// 		MO_CONFIG=./default.json
	//		MO_CONFIG_SCREEN1=./screen1.json
	//		MO_CONFIG_SCREEN2=https://config.example.com/screen2.json
	//
	// Note: it's the only way to load config file outside of monitoror directory
	NamedConfigs map[ConfigName]string
}

NamedConfig contain backend Configuration

func InitConfig

func InitConfig() *CoreConfig

InitConfig from configuration file / env / default value

Jump to

Keyboard shortcuts

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