config

package
v5.0.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBool

func GetBool(key string) bool

GetBool returns a bool config value.

func GetInt

func GetInt(key string) int

GetInt returns an int config value.

func GetString

func GetString(key string) string

GetString returns a string config value.

func Load

func Load(configDir string) error

Load reads configuration from JSON file and sets default values. configDir is the directory containing the config file.

Types

type APIConfig

type APIConfig struct {
	ServerURL     string        `json:"serverUrl" mapstructure:"serverUrl"`
	APIKey        string        `json:"apiKey" mapstructure:"apiKey"`
	UploadTimeout time.Duration `json:"uploadTimeout" mapstructure:"uploadTimeout"`
}

APIConfig holds HTTP client configuration for the OCAP web API.

func GetAPIConfig

func GetAPIConfig() APIConfig

GetAPIConfig returns the HTTP API client configuration.

type MemoryConfig

type MemoryConfig struct {
	OutputDir      string `json:"outputDir" mapstructure:"outputDir"`
	CompressOutput bool   `json:"compressOutput" mapstructure:"compressOutput"`
}

MemoryConfig holds in-memory/JSON storage backend settings

type OTelConfig

type OTelConfig struct {
	Enabled      bool          `json:"enabled" mapstructure:"enabled"`
	ServiceName  string        `json:"serviceName" mapstructure:"serviceName"`
	BatchTimeout time.Duration `json:"batchTimeout" mapstructure:"batchTimeout"`
	Endpoint     string        `json:"endpoint" mapstructure:"endpoint"` // OTLP endpoint (optional)
	Insecure     bool          `json:"insecure" mapstructure:"insecure"` // Use insecure for OTLP
}

OTelConfig holds OpenTelemetry configuration

func GetOTelConfig

func GetOTelConfig() OTelConfig

GetOTelConfig returns the OpenTelemetry configuration

type PostgresConfig added in v5.0.1

type PostgresConfig struct {
	Host     string `json:"host" mapstructure:"host"`
	Port     string `json:"port" mapstructure:"port"`
	Username string `json:"username" mapstructure:"username"`
	Password string `json:"password" mapstructure:"password"`
	Database string `json:"database" mapstructure:"database"`
}

PostgresConfig holds PostgreSQL storage backend connection settings.

type SQLiteConfig

type SQLiteConfig struct {
	DumpInterval time.Duration `json:"dumpInterval" mapstructure:"dumpInterval"`
}

SQLiteConfig holds SQLite storage backend settings

type StorageConfig

type StorageConfig struct {
	Type     string         `json:"type" mapstructure:"type"`
	Memory   MemoryConfig   `json:"memory" mapstructure:"memory"`
	SQLite   SQLiteConfig   `json:"sqlite" mapstructure:"sqlite"`
	Postgres PostgresConfig `json:"postgres" mapstructure:"postgres"`
}

StorageConfig holds storage backend configuration

func GetStorageConfig

func GetStorageConfig() StorageConfig

GetStorageConfig returns the storage backend configuration

Jump to

Keyboard shortcuts

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