Keyboard shortcuts

Press โ† or โ†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

init

Initialize the xrat config directory, config file, and database.

xrat init [--dry-run]

Flags

FlagDescription
--dry-runPrint planned actions without creating anything

Behavior

  1. Creates the app root directory ($HOME/.config/xrat/ or $XRAT_PATH)
  2. Writes a default config.toml with sensible defaults if not already present
  3. Creates the SQLite database and runs all pending migrations
  4. Creates subdirectories: runtime/, logs/, mmdb/
  5. Prints a summary of what was created and what was already present

Idempotent: safe to run multiple times. Existing files are never overwritten. If config.toml exists and has been customized, it is left untouched.

Example: first-time setup

xrat init
xrat initialized successfully.

Created:
  /home/user/.config/xrat/
  /home/user/.config/xrat/config.toml (written default template)
  /home/user/.config/xrat/runtime/
  /home/user/.config/xrat/logs/
  /home/user/.config/xrat/mmdb/

Already present:
  /home/user/.config/xrat/db.sqlite (database ready)

Next steps:
  xrat import <subscription-url>
  xrat list configs

Example: dry run

xrat init --dry-run
--- dry run: no files written ---

Would create (if absent):
  /home/user/.config/xrat/
  /home/user/.config/xrat/config.toml
  /home/user/.config/xrat/db.sqlite
  /home/user/.config/xrat/runtime/
  /home/user/.config/xrat/logs/
  /home/user/.config/xrat/mmdb/

State paths

PathPurposeOverride
$HOME/.config/xrat/App rootXRAT_PATH env var
$HOME/.config/xrat/config.tomlConfiguration--config flag
$HOME/.config/xrat/db.sqliteSQLite database--database flag
$HOME/.config/xrat/runtime/Daemon socket, session stateโ€”
$HOME/.config/xrat/logs/Runtime logs[runtime.log].dir
$HOME/.config/xrat/mmdb/GeoIP data[mmdb].dir

Default config.toml

The generated config enables SOCKS5 on port 1080, sets the Xray engine, and provides commented-out HTTP inbound and log settings:

[runtime]
engine = "xray"

[runtime.socks]
enabled = true
host = "127.0.0.1"
port = 1080

[runtime.http]
enabled = false
host = "127.0.0.1"
port = 8080

[runtime.log]
enabled = true
level = "warning"

[testing]
concurrency = 4

[geo]
auto_update = false

See Config File for full reference.