archivebox.config.common
Module Contents
Classes
Merged, typed ArchiveBox config. |
Functions
True if a config key names a credential and must be write-only in the UI. |
|
Return a copy of |
|
Return config filtered for runtime/frozen usage, optionally JSON-safe. |
|
Build the frozen crawl config stored on Crawl.config at creation time. |
|
Return one centralized metadata map for core and plugin config fields. |
|
Determine where a config value comes from. |
|
Return the per-request ArchiveBox config, upgrading to plugin resolution if needed. |
|
Get merged config from all sources. |
|
Get all config section objects as a dictionary. |
Data
API
- archivebox.config.common.permissions_from_legacy_public_flags(raw_config: collections.abc.Mapping[str, object]) str | None[source]
- archivebox.config.common.resolve_delete_after_config_value(*configs: collections.abc.Mapping[str, Any] | None) str[source]
- archivebox.config.common._SENSITIVE_CONFIG_KEY_NEEDLES[source]
(‘TOKEN’, ‘SECRET’, ‘API_KEY’, ‘APIKEY’, ‘PASSWORD’)
- archivebox.config.common.is_sensitive_config_key(key: str) bool[source]
True if a config key names a credential and must be write-only in the UI.
Matches any key whose uppercase form contains
TOKEN,SECRET,API_KEY,APIKEY, orPASSWORD— coversSECRET_KEY,OPENAI_API_KEY,TWOCAPTCHA_APIKEY,GITHUB_TOKEN,ADMIN_PASSWORD, etc. Centralized here so the KeyValueWidget (Machine/Crawl/Snapshot/Persona admin forms), the plugin config grid, REST API responses, and any future surface that round-trips raw config values all agree on which keys to redact.
- archivebox.config.common.redact_sensitive_config(config: collections.abc.Mapping[str, Any] | None) dict[str, Any][source]
Return a copy of
configwith credential values replaced by********.Used wherever a config dict crosses an API/export/debug-dump boundary. The widget-side write-only treatment handles the form-render path; this helper handles every JSON-response path (REST schemas,
to_jsonexports, admin debug views, etc.). Empty values are passed through unchanged so callers can still tell “unset” from “set-but-hidden.”
- archivebox.config.common.normalize_runtime_config(config: archivebox.config.configset.BaseConfigSet | collections.abc.Mapping[str, Any] | str | None, *, only_crawl_execution: bool = False, exclude_runtime_derived: bool = False, exclude_crawl_execution: bool = False, json_safe: bool = True) dict[str, Any][source]
Return config filtered for runtime/frozen usage, optionally JSON-safe.
- archivebox.config.common.build_crawl_config_snapshot(*, persona: Any = None, overrides: collections.abc.Mapping[str, Any] | None = None, base_config: ArchiveBoxBaseConfig | collections.abc.Mapping[str, object] | None = None) dict[str, Any][source]
Build the frozen crawl config stored on Crawl.config at creation time.
- class archivebox.config.common.ServerConfig[source]
- class archivebox.config.common.ArchivingConfig[source]
- archivebox.config.common._plugin_user_config(config: collections.abc.Mapping[str, object]) dict[str, str][source]
- archivebox.config.common._discover_plugin_config_schemas() archivebox.config.common.PluginSchemaDocuments[source]
- archivebox.config.common._plugin_config_properties(plugin_schemas: archivebox.config.common.PluginSchemaDocuments) dict[str, dict[str, Any]][source]
- archivebox.config.common._plugin_config_model(plugin_schemas: archivebox.config.common.PluginSchemaDocuments) type[pydantic.BaseModel][source]
- class archivebox.config.common.ArchiveBoxBaseConfig[source]
Bases:
archivebox.config.common.ShellConfig,archivebox.config.common.StorageConfig,archivebox.config.common.GeneralConfig,archivebox.config.common.ServerConfig,archivebox.config.common.DatabaseConfig,archivebox.config.common.ArchivingConfig,archivebox.config.common.SearchBackendConfig,archivebox.config.ldap.LDAPConfigMerged, typed ArchiveBox config.
Core ArchiveBox fields are declared above. Plugin-owned fields are added to the concrete ArchiveBoxConfig model from plugin JSONSchema below, so ArchiveBox does not hardcode any individual plugin config names.
- classmethod _core_config_classes() tuple[type[archivebox.config.configset.BaseConfigSet], ...][source]
- for_crawl() dict[str, Any][source]
Config scoped to crawl execution, without runtime object overlays.
- for_crawl_frozen(*, persona: Any = None) dict[str, Any][source]
Config safe to persist permanently on Crawl.config.
- for_crawl_runtime(*, crawl: Any = None, snapshot: Any = None, persona: Any = None, runtime_overrides: collections.abc.Mapping[str, Any] | None = None, extra_context: collections.abc.Mapping[str, Any] | None = None, crawl_output_dir: Any = None, snapshot_output_dir: Any = None) dict[str, Any][source]
Config payload safe to pass to crawl/snapshot hook execution.
- archivebox.config.common._build_archivebox_config_model(plugin_schemas: archivebox.config.common.PluginSchemaDocuments) type[archivebox.config.common.ArchiveBoxBaseConfig][source]
- archivebox.config.common.config_field_metadata() dict[str, dict[str, Any]][source]
Return one centralized metadata map for core and plugin config fields.
- archivebox.config.common.find_config_source(key: str, merged_config: collections.abc.Mapping[str, Any]) str[source]
Determine where a config value comes from.
- archivebox.config.common.get_request_config(request: Any, *, resolve_plugins: bool = False) archivebox.config.common.ArchiveBoxBaseConfig[source]
Return the per-request ArchiveBox config, upgrading to plugin resolution if needed.
- archivebox.config.common.get_config(defaults: archivebox.config.common.ConfigOverrides | None = None, overrides: archivebox.config.common.ConfigOverrides | None = None, base_config: archivebox.config.common.ArchiveBoxBaseConfig | collections.abc.Mapping[str, object] | None = None, persona: Any = None, crawl: Any = None, snapshot: Any = None, machine: Any = None, include_machine: bool = True, resolve_plugins: bool = True, redact_sensitive: bool = False) archivebox.config.common.ArchiveBoxBaseConfig[source]
Get merged config from all sources.
Defaults are hydrated by pydantic from core/plugin defaults, ArchiveBox.conf, and environment variables. Persisted Machine/Persona values then apply for live crawl-execution scope, while Crawl/Snapshot rows apply their frozen crawl-scope values. Explicit overrides win last.
Crawl-execution config is not persisted on Crawl.config. It is rederived from current Machine/Persona state and hydrated process defaults each time.
- archivebox.config.common.get_all_configs() dict[str, archivebox.config.configset.BaseConfigSet][source]
Get all config section objects as a dictionary.