buckethead.config.user¶
Per-user config at ~/.config/buckethead/config.toml (XDG-respecting).
Two jobs:
[env]— key/value pairs merged intoos.environviasetdefault()on CLI startup, soBUCKETHEAD_*env vars can be set once per machine instead of exported per shell.[projects]— persistentproject → bucketmap, with optionalshare/share_mode/share_public_base_urlfields for projects that have been throughbuckethead provision share-bucket.
Inspect via buckethead config path / buckethead config show.
buckethead.config.user
¶
User-level config at ~/.config/buckethead/config.toml.
Loaded via pydantic-settings with TomlConfigSettingsSource for the
read-side view. Writes are additive: every mutation reads the file
through tomlkit, splices just the affected key, and writes back.
Untouched sections, unknown tables, comments, and formatting survive
the round trip — so multiple projects can safely share one file and
schema drift never silently drops fields.
Two known sections:
-
env— key/value pairs surfaced toBucketHeadSettingsvia a custom pydantic-settings source (UserConfigEnvSource). Values may be literal strings or secret-store refs likeop://vault/item/field; refs are resolved at load time viasecret_refs.resolve_value. -
projects— persistentproject → bucket namemap. Values are either a string (primary bucket only) or an inline table{primary = "...", share = "...", share_mode = "...", ...}.
XDG Base Directory spec is honored: $XDG_CONFIG_HOME/buckethead/
wins over the ~/.config/buckethead/ default.
UserConfig
¶
Bases: BaseSettings
load
classmethod
¶
forget_project
¶
Remove a project mapping (primary + share) and persist.
bucket_for_project
¶
Return the primary bucket for project; generate and persist on miss.
Source code in src/buckethead/config/user.py
configure_share_for_project
¶
configure_share_for_project(
project: str,
*,
share_bucket: str,
mode: str,
public_base_url: str | None = None,
path: Path | None = None,
) -> None
Attach or update share config on an existing project entry.
Raises KeyError if the project isn't present — call
bucket_for_project first to create the primary.
Source code in src/buckethead/config/user.py
forget_share_for_project
¶
Detach the share bucket; demote to string form if only primary remains.
Source code in src/buckethead/config/user.py
UserConfigEnvSource
¶
Bases: EnvSettingsSource
Pydantic-settings source backed by the [env] table in
~/.config/buckethead/config.toml, with secret-ref resolution.
set_env_var
¶
Upsert a single [env] key.
Source code in src/buckethead/config/user.py
unset_env_var
¶
Remove a single [env] key; drop the section if it becomes empty.
Source code in src/buckethead/config/user.py
set_project
¶
set_project(
project: str,
*,
primary: str | None = None,
share: str | None = None,
share_mode: str | None = None,
share_public_base_url: str | None = None,
clear_public_base_url: bool = False,
path: Path | None = None,
) -> None
Upsert a project entry. Only the passed kwargs mutate; others pass through.
Source code in src/buckethead/config/user.py
unset_project
¶
Drop a project entirely; drop the section if it becomes empty.
Source code in src/buckethead/config/user.py
unset_share_for_project
¶
Strip share fields from a project entry; demote to string form if only
primary remains.