config

package
v0.0.0-...-363ef37 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPort                   = 8080
	DefaultDataDir                = "./data"
	DefaultUpdateInterval         = 24 * time.Hour
	DefaultOSVBaseURL             = "https://storage.googleapis.com/osv-vulnerabilities"
	DefaultMaxRetries             = 3
	DefaultRetryDelay             = 5 * time.Second
	DefaultConfigFile             = "config.ini"
	DefaultEnableDownloadEndpoint = false
	DefaultPeers                  = ""
)
View Source
const (
	EnvPort                   = "OSV_PORT"
	EnvDataDir                = "OSV_DATA_DIR"
	EnvUpdateInterval         = "OSV_UPDATE_INTERVAL"
	EnvOSVBaseURL             = "OSV_BASE_URL"
	EnvMaxRetries             = "OSV_MAX_RETRIES"
	EnvRetryDelay             = "OSV_RETRY_DELAY"
	EnvEnableDownloadEndpoint = "OSV_ENABLE_DOWNLOAD_ENDPOINT"
	EnvPeers                  = "OSV_PEERS"
)
View Source
const (
	ConfigKeyPort                   = "port"
	ConfigKeyDataDir                = "data_dir"
	ConfigKeyUpdateInterval         = "update_interval"
	ConfigKeyOSVBaseURL             = "osv_base_url"
	ConfigKeyMaxRetries             = "max_retries"
	ConfigKeyRetryDelay             = "retry_delay"
	ConfigKeyEnableDownloadEndpoint = "enable_download_endpoint"
	ConfigKeyPeers                  = "peers"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port                   int
	DataDir                string
	UpdateInterval         time.Duration
	OSVBaseURL             string
	MaxRetries             int
	RetryDelay             time.Duration
	ConfigFile             string
	EnableDownloadEndpoint bool
	Peers                  []string
}

Config holds all configuration for the OSV server.

func Load

func Load() (*Config, error)

Load loads configuration from command line flags, environment variables, and config file. Priority: flags > env > config file > defaults

func LoadWithArgs

func LoadWithArgs(args []string) (*Config, error)

LoadWithArgs is like Load but allows passing arguments explicitly (useful for testing).

Jump to

Keyboard shortcuts

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