config

package
v0.0.4-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config provides configuration loading and persistence for MALT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir(configPath string) (string, error)

ConfigDir returns the parent directory of the config file.

func DefaultConfigPath

func DefaultConfigPath() (string, error)

DefaultConfigPath returns the canonical default config path.

func ExpandPath

func ExpandPath(path string) (string, error)

ExpandPath expands "~" prefixes and cleans the resulting path.

func ResolveConfigPath

func ResolveConfigPath(explicit string) (string, error)

ResolveConfigPath returns the explicit path if provided, otherwise the default path.

func WriteToFile

func WriteToFile(path string, cfg *Config) error

WriteToFile writes the config to the given path in pretty JSON format.

Types

type ArcTableConfig

type ArcTableConfig struct {
	Type string `json:"type"`
}

ArcTableConfig configures the ArcTable implementation.

type CASConfig

type CASConfig struct {
	Mode    string `json:"mode"`
	BaseURL string `json:"base_url,omitempty"`
	Timeout string `json:"timeout"`
}

CASConfig configures the immutable content backend.

type ClientConfig

type ClientConfig struct {
}

ClientConfig configures client-side CLI defaults.

type Config

type Config struct {
	RPC       RPCConfig       `json:"rpc"`
	State     StateConfig     `json:"state"`
	Structure StructureConfig `json:"structure"`
	CAS       CASConfig       `json:"cas"`
	Logging   LoggingConfig   `json:"logging"`
	Client    ClientConfig    `json:"client"`
}

Config is the root configuration for the MALT runtime.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the runtime default configuration.

func Load

func Load() (*Config, error)

Load loads configuration from the default config path if it exists, otherwise returns defaults.

func LoadFromFile

func LoadFromFile(path string) (*Config, error)

LoadFromFile loads configuration from a specific file.

func (*Config) APIBaseURL

func (c *Config) APIBaseURL() string

APIBaseURL returns the daemon API base URL.

func (*Config) CASBaseURL

func (c *Config) CASBaseURL() string

CASBaseURL returns the active CAS HTTP endpoint.

func (*Config) CASTimeout

func (c *Config) CASTimeout() (time.Duration, error)

CASTimeout parses and returns the CAS timeout.

func (*Config) KVStorePath

func (c *Config) KVStorePath() string

KVStorePath returns the absolute KVStore path.

func (*Config) RPCBaseURL

func (c *Config) RPCBaseURL() string

RPCBaseURL returns the daemon base URL.

func (*Config) String

func (c *Config) String() string

String returns a compact string representation of the config.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates and normalizes the config.

type KVStoreConfig

type KVStoreConfig struct {
	Type string `json:"type"`
	Path string `json:"path"`
}

KVStoreConfig configures the local KV store.

type LoggingConfig

type LoggingConfig struct {
	Level  string `json:"level"`
	Format string `json:"format"`
}

LoggingConfig configures runtime logging.

type RPCConfig

type RPCConfig struct {
	Listen             string   `json:"listen"`
	CORSAllowedOrigins []string `json:"cors_allowed_origins,omitempty"`
}

RPCConfig configures the local daemon HTTP endpoint.

type StateConfig

type StateConfig struct {
	RootDir  string         `json:"root_dir"`
	KVStore  KVStoreConfig  `json:"kvstore"`
	ArcTable ArcTableConfig `json:"arctable"`
}

StateConfig configures local durable runtime state.

type StructureConfig

type StructureConfig struct {
	DefaultBackend string `json:"default_backend"`
}

StructureConfig configures structure runtime defaults.

Jump to

Keyboard shortcuts

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