config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ModuleName = "cm-centipede"

Variables

This section is empty.

Functions

func ExpandTilde

func ExpandTilde(p string) string

ExpandTilde expands a leading "~/" to the current user's home directory. Go does not expand tilde automatically; paths from config/env must be processed through this function before being passed to os/filepath calls.

func Init

func Init()

Init loads configuration from the YAML file and applies environment variable overrides.

func RootPath

func RootPath() string

RootPath returns the root directory for cm-centipede data. Uses CENTIPEDE_ROOT env var if set, otherwise defaults to ~/.cm-centipede.

func Validate

func Validate() error

Validate refuses a configuration that still carries the shipped placeholder credentials, naming every offending key and the variable that overrides it.

Types

type APIConfig

type APIConfig struct {
	Allow     AllowConfig `mapstructure:"allow"`
	Auth      AuthConfig  `mapstructure:"auth"`
	Username  string      `mapstructure:"username"`
	Password  string      `mapstructure:"password"`
	RateLimit int         `mapstructure:"rateLimit"`
}

type AllowConfig

type AllowConfig struct {
	Origins string `mapstructure:"origins"`
}

type AuthConfig

type AuthConfig struct {
	Enabled bool   `mapstructure:"enabled"`
	Mode    string `mapstructure:"mode"`
}

type BeetleConfig

type BeetleConfig struct {
	Endpoint string `mapstructure:"endpoint"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
}

BeetleConfig holds the cm-beetle REST endpoint and Basic Auth credentials. cm-beetle is the only reference source for migration targets: node SSH access and object storage both resolve through it.

type CentipedeConfig

type CentipedeConfig struct {
	Self       SelfConfig       `mapstructure:"self"`
	Honeybee   HoneybeeConfig   `mapstructure:"honeybee"`
	Beetle     BeetleConfig     `mapstructure:"beetle"`
	Tumblebug  TumblebugConfig  `mapstructure:"tumblebug"`
	API        APIConfig        `mapstructure:"api"`
	DB         DBConfig         `mapstructure:"db"`
	Migration  MigrationConfig  `mapstructure:"migration"`
	Encryption EncryptionConfig `mapstructure:"encryption"`
	Logfile    LogfileConfig    `mapstructure:"logfile"`
	Loglevel   string           `mapstructure:"loglevel"`
	Logwriter  string           `mapstructure:"logwriter"`
	Node       NodeConfig       `mapstructure:"node"`
}
var Conf CentipedeConfig

Conf is the global configuration instance.

type DBConfig

type DBConfig struct {
	Path string `mapstructure:"path"`
}

type EncryptionConfig

type EncryptionConfig struct {
	SecretKey string `mapstructure:"secretKey"`
}

type HoneybeeConfig

type HoneybeeConfig struct {
	Endpoint       string `mapstructure:"endpoint"`
	PrivateKeyPath string `mapstructure:"privateKeyPath"`
}

type LogfileConfig

type LogfileConfig struct {
	Path       string `mapstructure:"path"`
	MaxSize    int    `mapstructure:"maxsize"`
	MaxBackups int    `mapstructure:"maxbackups"`
	MaxAge     int    `mapstructure:"maxage"`
}

type MigrationConfig

type MigrationConfig struct {
	// StagingDir is the local staging root used when a migration request names
	// none. Empty leaves the choice to data-mig: $TMPDIR/datamig-staging, or
	// /tmp/datamig-staging when TMPDIR is unset. Init stores it as an absolute
	// path.
	StagingDir string `mapstructure:"stagingDir"`

	// Concurrency is how many transfers each item runs at once when a migration
	// request names none: 1 to 32, or 0 to leave data-mig's default (4).
	Concurrency int `mapstructure:"concurrency"`
}

MigrationConfig holds server-wide defaults for migration execution.

type NodeConfig

type NodeConfig struct {
	Env string `mapstructure:"env"`
}

type SelfConfig

type SelfConfig struct {
	Endpoint string `mapstructure:"endpoint"`
}

type TumblebugConfig

type TumblebugConfig struct {
	Endpoint string `mapstructure:"endpoint"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
}

TumblebugConfig holds the cb-tumblebug REST endpoint used during object storage transfers only. data-mig reaches managed buckets through cb-tumblebug's ObjectStorage API, so the endpoint is still needed even though cb-tumblebug is not a selectable connection source.

Jump to

Keyboard shortcuts

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