pub struct Config {
pub bucket: String,
pub local: LocalConfig,
pub indexd: Option<IndexdConfig>,
pub serve: ServeConfig,
pub chunking: ChunkingConfig,
pub credential_store_version: Option<u32>,
}Expand description
Top-level ObsidianLog configuration, persisted as TOML.
Fields§
§bucket: StringStorage bucket / namespace logs are archived under.
local: LocalConfigLocal (default) storage backend settings.
indexd: Option<IndexdConfig>How to reach the user’s indexd deployment. None (the default) uses the
local backend only; set this when archiving to Sia (sia feature).
serve: ServeConfigLocal HTTP ingest server settings.
chunking: ChunkingConfigChunking / time-window settings.
credential_store_version: Option<u32>Which local credential-storage layout this config expects (see the
module docs and ADR-0015). None when parsed from a file that
predates this field — treated as the legacy, two-item layout.
Explicitly #[serde(default)] (defaulting to None) rather than
relying on the struct’s blanket default, following the same pattern
already used for indexd above, so a missing field always means
“legacy” regardless of what Config::default()’s own value is.
Implementations§
Source§impl Config
impl Config
Sourcepub fn default_path() -> Result<PathBuf>
pub fn default_path() -> Result<PathBuf>
Resolve the default config path ($XDG_CONFIG_HOME/obsidianlog/config.toml,
falling back to ~/.config/obsidianlog/config.toml, using USERPROFILE
in place of HOME on Windows when HOME itself isn’t set).
Sourcepub fn load(path: Option<&Path>) -> Result<Self>
pub fn load(path: Option<&Path>) -> Result<Self>
Load configuration from path, or the default path when None.
An explicit path must exist. With no path, a missing file at the
resolved default location is not an error — Config::default is used
instead, so commands work with zero setup against the local backend.
Every command except init must use this function: a config whose
credential-storage format doesn’t match CURRENT_CREDENTIAL_VERSION
(missing — legacy — or newer than this build understands) fails here,
before any keychain access happens. init alone uses
Config::load_for_init instead, since offering a route back to a
fresh setup is specifically its job (see ADR-0015); no other caller
should ever see a legacy config as anything but a hard failure.
Sourcepub fn load_for_init(path: Option<&Path>) -> Result<ConfigLoadOutcome>
pub fn load_for_init(path: Option<&Path>) -> Result<ConfigLoadOutcome>
Load configuration for init’s use only. Unlike Config::load, a
missing config file resolves to ConfigLoadOutcome::Missing
(whether path was explicit or defaulted — init treats both the
same, since either way it means “nothing to reuse yet”) and a legacy
config resolves to ConfigLoadOutcome::Legacy rather than erroring,
so init can print what continuing would abandon and offer a
supported route to a fresh setup. An unrecognized future format
still errors here exactly as it does in Config::load — there’s no
reasonable repair action for a config written by a newer build.