Configuration Options¶
Archae has several configuration options that control its behavior. These can be set via environment variables, configuration files, or programmatically through the library.
Order of precedence¶
Default values
User config file (~/.config/archae)
Env vars
Invoker (CLI: -o flags / Module: the apply_options function)
Options¶
MAX_ARCHIVE_SIZE_BYTES¶
Type: int
Description: Maximum size of a single archive to extract in bytes.
Default: 10G
Converter: archae.util.converter.file_size:convert
Examples:
1GB500M500
MAX_TOTAL_SIZE_BYTES¶
Type: int
Description: Maximum total size of all archives to extract in bytes.
Default: 100G
Converter: archae.util.converter.file_size:convert
Examples:
1GB500M500
MIN_ARCHIVE_RATIO¶
Type: float
Description: Minimum compression ratio (compressed size / uncompressed size) required to extract an archive.
Default: 0.005
Examples:
0.001
MIN_DISK_FREE_SPACE¶
Type: int
Description: Minimum required estimated disk space after extraction in bytes.
Default: 10G
Converter: archae.util.converter.file_size:convert
Examples:
1GB500M500
DELETE_ARCHIVES_AFTER_EXTRACTION¶
Type: bool
Description: Whether to delete archives after extraction.
Default: False
Converter: bool
Examples:
TrueFalse
MAX_DEPTH¶
Type: int
Description: Maximum extraction depth for nested archives. Use 0 for unlimited depth.
Default: 0
Converter: int
Examples:
35100
Setting Configuration Options¶
Via Environment Variables¶
Set environment variables prefixed with ARCHAE_:
export ARCHAE_MAX_ARCHIVE_SIZE_BYTES=5000000000
export ARCHAE_MIN_ARCHIVE_RATIO=0.01
Via Configuration File¶
Edit ~/.config/archae/settings.toml:
MAX_ARCHIVE_SIZE_BYTES = 5000000000
MIN_ARCHIVE_RATIO = 0.01
MIN_DISK_FREE_SPACE = 1000000000
Via CLI Arguments¶
Pass options directly to the command line:
archae --max_archive_size_bytes=5000000000 --min_archive_ratio=0.01 archive.zip
Programmatically¶
When using Archae as a library, use the apply_options() method:
from archae import ArchiveExtractor
extractor = ArchiveExtractor()
extractor.apply_options({
"MAX_ARCHIVE_SIZE_BYTES": 5000000000,
"MIN_ARCHIVE_RATIO": 0.01
})
extractor.handle_file(Path("archive.zip"))