Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config loads the Factorix configuration from config.toml. The file format is shared with the Ruby implementation, so existing configuration files carry over unchanged.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidConfig = errors.New("invalid configuration")

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Download CacheType `toml:"download"`
	API      CacheType `toml:"api"`
	InfoJSON CacheType `toml:"info_json"`
}

Cache holds the per-cache-type settings.

type CacheType

type CacheType struct {
	Backend    string            `toml:"backend"`
	TTL        *int64            `toml:"ttl"` // seconds; nil = unlimited
	FileSystem FileSystemBackend `toml:"file_system"`
	// Redis and S3 are accepted so Ruby-era configuration files still load,
	// but the backends are out of scope for the Go version and the values
	// are ignored.
	Redis RedisBackend `toml:"redis"`
	S3    S3Backend    `toml:"s3"`
}

CacheType configures one cache instance.

type Config

type Config struct {
	LogLevel string  `toml:"log_level"`
	Runtime  Runtime `toml:"runtime"`
	RCON     RCON    `toml:"rcon"`
	HTTP     HTTP    `toml:"http"`
	Cache    Cache   `toml:"cache"`
}

Config is the application configuration.

func Default

func Default() Config

Default returns the default configuration, matching the Ruby DEFAULTS.

func LoadFile

func LoadFile(path string) (Config, error)

LoadFile reads a config.toml, applying its values over the defaults.

type FileSystemBackend

type FileSystemBackend struct {
	MaxFileSize          *int64 `toml:"max_file_size"`         // bytes; nil = unlimited
	CompressionThreshold *int64 `toml:"compression_threshold"` // bytes; nil = never compress
}

FileSystemBackend configures the filesystem cache backend.

type HTTP

type HTTP struct {
	ConnectTimeout int `toml:"connect_timeout"`
	ReadTimeout    int `toml:"read_timeout"`
	WriteTimeout   int `toml:"write_timeout"`
}

HTTP holds HTTP timeout settings in seconds.

type RCON

type RCON struct {
	Host     string `toml:"host"`
	Port     int    `toml:"port"`
	Password string `toml:"password"`
}

RCON holds RCON connection settings.

type RedisBackend

type RedisBackend struct {
	URL         string `toml:"url"`
	LockTimeout int64  `toml:"lock_timeout"`
}

RedisBackend is accepted for Ruby-file compatibility only.

type Runtime

type Runtime struct {
	ExecutablePath string `toml:"executable_path"`
	UserDir        string `toml:"user_dir"`
	DataDir        string `toml:"data_dir"`
}

Runtime holds path overrides; an empty value means platform auto-detection.

type S3Backend

type S3Backend struct {
	Bucket      string `toml:"bucket"`
	Region      string `toml:"region"`
	LockTimeout int64  `toml:"lock_timeout"`
}

S3Backend is accepted for Ruby-file compatibility only.

Jump to

Keyboard shortcuts

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