-
-
Notifications
You must be signed in to change notification settings - Fork 5
Environment Variables
Every setting MailGrab has can be set as an environment variable, which is useful for CI jobs, Docker containers, or anywhere you'd rather not repeat long flag lists.
For every setting, the order is:
CLI flag → environment variable → built-in default
--config path.json sits below environment variables in that chain: loading a config file only fills in an environment variable via os.environ.setdefault(...) if it isn't already set — it never overrides one that's genuinely set in your shell, and a CLI flag always wins over both. See Configuration File for why it's built this way.
| Variable | Type | Default | Matching flag |
|---|---|---|---|
MAILGRAB_MAX_WORKERS |
integer | 10 |
--concurrency |
MAILGRAB_DELAY |
float (seconds) | 0 |
--delay |
MAILGRAB_TIMEOUT |
float (seconds) | 10 |
--timeout |
MAILGRAB_SAME_DOMAIN |
1 or 0
|
0 |
--same-domain |
MAILGRAB_IGNORE_ROBOTS |
1 or 0
|
0 |
--ignore-robots |
MAILGRAB_APPEND |
1 or 0
|
0 |
--append |
MAILGRAB_RESUME |
1 or 0
|
0 |
--resume |
MAILGRAB_USE_SITEMAP |
1 or 0
|
0 |
--use-sitemap |
MAILGRAB_VERIFY_MX |
1 or 0
|
0 |
--verify-mx |
MAILGRAB_QUIET |
1 or 0
|
0 |
--quiet |
MAILGRAB_MAX_HOPS |
integer | unset (unlimited) | --max-hops |
MAILGRAB_USER_AGENT |
string | MailGrab's default UA string | --user-agent |
MAILGRAB_PROXY |
url string | unset | --proxy |
There's no environment variable for --url, --depth, --input, or --config — those are either genuinely interactive prompts or file paths that don't make sense to leave lying around in a shell profile.
The boolean ones (SAME_DOMAIN, IGNORE_ROBOTS, APPEND, RESUME, USE_SITEMAP, VERIFY_MX, QUIET) are checked with an exact string comparison against "1" — any other value (including "true", "yes", or an empty string) is treated as off. This matches how the --config file also writes them (see Configuration File).
export MAILGRAB_MAX_WORKERS=20
export MAILGRAB_TIMEOUT=15
export MAILGRAB_SAME_DOMAIN=1
python MailGrab.py --url https://example.com --depth 100is equivalent to:
python MailGrab.py --url https://example.com --depth 100 --concurrency 20 --timeout 15 --same-domain