# Example pesto configuration.
#
# Copy this file to your config directory so pesto loads it automatically:
#
#   $XDG_CONFIG_HOME/pesto/config.toml   (or ~/.config/pesto/config.toml)
#
# Or generate it interactively with `pesto --config`.
#
# Every field is optional and can be overridden by the matching CLI flag.
# Commented-out fields show their built-in default.

# ── Single-server configuration ─────────────────────────────────────────────
#
# Use [server] + [auth] when you have one provider. For multiple servers with
# automatic failover, replace these sections with [[servers]] entries (see
# the "Multi-server failover" section below).

[server]
host = "news.example.com"
# port = 563          # NNTP port; 563 is TLS, 119 is plaintext. Default: 563.
# ssl = true          # Connect over TLS. Default: true. (--no-ssl to disable.)
# connections = 4     # Parallel NNTP connections — the main throughput lever.
                      # Default: 4. Most providers allow 10–50.
# retry_delay = 1     # Seconds to wait between failed post attempts. Default: 1.

[auth]
# Credentials for the NNTP server. Omit the whole section for open servers.
# Never commit a real password to version control.
username = "your_username"
password = "your_password"

# ── Multi-server failover ────────────────────────────────────────────────────
#
# Define two or more [[servers]] entries to enable automatic failover.
# The first entry is the primary; the rest are tried in order when a
# connection fails. When [[servers]] is present, [server] and [auth] are
# ignored. Each entry may have its own credentials and connection count.
#
# [[servers]]
# host = "news.primary.com"
# port = 563
# ssl = true
# connections = 10
# username = "user1"
# password = "pass1"
# retry_delay = 1
#
# [[servers]]
# host = "news.fallback.com"
# port = 563
# ssl = true
# connections = 4
# username = "user2"
# password = "pass2"
# retry_delay = 2

[posting]
# from — the `From` header on every article.
# When omitted, pesto posts under a freshly generated random identity, with a
# random name and a random number of characters, on every run. Set a fixed
# value only if you specifically need one.
# from = "poster <poster@example.com>"

# Newsgroups to post to. At least one is required (unless --par2-only).
groups = ["alt.binaries.test"]

# article_size — target size of each posted segment, in bytes. Default: 768000.
# article_size = 768000

# line_length — yEnc encoded line length, in characters. Default: 128.
# line_length = 128

# retries — post attempts per segment before it is marked failed. Default: 3.
# retries = 3

# obfuscate — how much of each post to hide. Default: "none".
#   "none"    real file name in the subject and the yEnc header
#   "subject" random subject; yEnc header keeps the real name
#   "full"    random subject and random yEnc name (recover via the .nzb)
# obfuscate = "none"

# par2 — percentage of PAR2 recovery data to generate. 0 disables it.
# Default: 10.
# par2 = 10

# verify — confirm each posted article is present on the server via STAT
# and repost if not found. Adds one round-trip per article. Default: false.
# verify = false

# upload_rate — maximum total upload speed across all connections.
# Accepts human-readable values: "50 MiB/s", "10 MB/s", "1024 KiB/s".
# 0 or omitted means unlimited. Also settable with --rate.
# upload_rate = "0"

# date — value for the `Date:` header on each article. Options:
#   "now"    current UTC time at the moment of posting (default)
#   "random" a random time within the last 30 days
#   A fixed RFC 2822 timestamp: "Mon, 01 Jan 2024 12:00:00 +0000"
# When omitted, pesto does not set the Date header and lets the server supply it.
# date = "random"

# no_archive — add `X-No-Archive: yes` to every posted article. Default: false.
# no_archive = false

# message_id_domain — fixed domain used in the Message-ID of every article.
# When omitted (default), a fresh random domain is generated per article, which
# is better for privacy. Set this only if your provider requires a stable domain.
# message_id_domain = "example.com"

[compression]
# Bundle files into an archive before posting. Default: disabled.
#
# format — archive format to use. Default: "7z" (store mode, no compression).
#   "7z"  via p7zip; encrypts headers too when a password is set (-mhe=on)
#   "zip" via p7zip; standard zip with optional password (no header encryption)
#   "rar" via rar binary (not distributed; must be in PATH)
#
# Use --compress [FORMAT] on the CLI to enable for a single run.
# Use --password [PASSWORD] to add a password (implies --compress 7z).
# Omitting FORMAT or leaving format unset defaults to "7z".
#
# format = "7z"

[output]
# nzb_dir — directory where .nzb files are saved by default.
# The filename is derived from the upload name (<stem>.nzb).
# Overridden by --out or output.nzb.
# nzb_dir = "/home/user/nzbs"

# nzb — fixed path for the generated .nzb file. Overrides nzb_dir.
# Overridden by --out.
# nzb = "upload.nzb"

# nzb_name — value for the <meta type="name"> element in the .nzb.
# Shown as the release title in NZBGet and SABnzbd. Defaults to the upload name.
# nzb_name = "My Release (2024)"

# nzb_category — value for the <meta type="category"> element in the .nzb.
# nzb_category = "TV > HD"

# nzb_password — value for the <meta type="password"> element in the .nzb.
# When --password is used, the archive password is stored here automatically.
# Use this only to set a static password independently of --compress.
# nzb_password = "archive_pass"

# nfo — generate a .nfo text file alongside the .nzb. Default: false.
# Runs `mediainfo` on the first video file found; falls back to a directory
# listing when no video file is present or mediainfo is not installed.
# nfo = false

# post_hook — shell command executed after each successful upload.
# Runs via `sh -c` on Unix or `cmd /c` on Windows. The following environment
# variables are available: PESTO_NZB, PESTO_NFO, PESTO_NAME, PESTO_BYTES,
# PESTO_GROUP, PESTO_PASSWORD, PESTO_SERVER.
# post_hook = "notify-send 'pesto' 'Upload done: $PESTO_NAME'"

# history — write a record to history.jsonl after each upload. Default: true.
# history = true

# history_dir — directory where history.jsonl and nzb/ are stored.
# Default: ~/.config/pesto  (or $XDG_CONFIG_HOME/pesto).
# Set to ~/.config/upapasta to share the catalog with upapasta.
# history_dir = "~/.config/upapasta"

# quiet — single-line minimal output instead of the full terminal panel.
# Designed for tmux/screen users who want minimal terminal noise. Default: false.
# quiet = false

# bell — write an ASCII BEL (\a) to stderr on completion (success or failure).
# Useful for desktop notification integrations. Default: false.
# bell = false

# ── Indexer upload ───────────────────────────────────────────────────────────
#
# Automatically POST the generated .nzb to a Newznab-compatible indexer after
# each successful upload. Skip for a single run with --no-upload.
#
# [output.indexer]
# url     = "https://my.indexer.com"
# api_key = "abc123"
# category = "5000"   # optional Newznab category ID

# ── Completion notifications ─────────────────────────────────────────────────
#
# Send a notification after each upload (success or failure).
# Both fields are optional; omit the whole section to disable notifications.
#
# [notify]
# webhook_url — HTTP POST target (Discord, Slack, Telegram, or generic JSON).
#   Discord:  https://discord.com/api/webhooks/<id>/<token>
#   Slack:    https://hooks.slack.com/services/...
#   Telegram: https://api.telegram.org/bot<token>/sendMessage?chat_id=<id>
#   Generic:  any URL; receives a rich JSON object with upload details
# webhook_url = "https://discord.com/api/webhooks/..."
#
# ntfy_topic — ntfy.sh topic name or full URL (e.g. "https://ntfy.sh/mytopic").
# ntfy_topic = "pesto-uploads"
