Skip to content

Configuration ​

Server-side settings come from a TOML file, environment variables and CLI flags. Precedence:

built-in defaults ← config file ← environment (GRA_*) ← CLI flags

The config file is --config / GRA_CONFIG (an error if it doesn't exist), otherwise ./gra.toml when present. Unknown keys and invalid values are rejected at startup, so typos never go unnoticed.

Options ​

KeyDefaultDescription
bot_token—Telegram bot token (required to run the daemon)
db_pathgra.dbSQLite path or file: URI
tick_secs15How often due accounts are looked up
ig_delay_ms1200Pause between paginated Instagram requests
http_timeout_secs60Timeout for Instagram requests
max_concurrent_checks2Accounts checked in parallel
log_levelinfoTracing filter, e.g. gra=debug,info (RUST_LOG takes precedence)
log_filenoneLog file rotated daily (7 kept); omit for stderr
allowed_user_ids[]Telegram user allowlist; empty = everyone
default_interval_secs1800Check interval for new users' accounts (≥ 60)
default_send_poststrueNew users: deliver posts
default_send_storiestrueNew users: deliver stories
default_send_videostrueNew users: upload videos (else caption + link)
default_track_statstrueNew users: record follower/following/post counts
max_send_per_check5Posts delivered per account per check; the rest follow next check
media_group_size10Items per Telegram album (2-10)
max_follow_list60Entries loaded from a user's following list
tg_base_urlhttps://api.telegram.orgBot API base (e.g. a local Bot API server)
ig_base_urlhttps://www.instagram.comInstagram base (tests)
cookie_sets[]Server-owner 🌐 cookie sets: name, cookies, optional ua

The default_* values seed each new user's /defaults; every user can change their own afterwards.

Example ​

toml
bot_token = "123456:..."
db_path   = "file:/data/gra.db?mode=rwc"
log_file  = "/data/logs/gra.log"
allowed_user_ids = [11111111, 22222222]

[[cookie_sets]]                         # shared fallback for all users
name = "owner"
cookies = "file:/data/owner-cookies.txt" # or 'k=v; k2=v2' / cookies.txt content
ua = "Mozilla/5.0 ..."

Global cookie sets are synced on every start: entries are matched by name (case-insensitive) and updated; sets removed from the config are deleted, and accounts linked to them fall back to Auto.

Environment variables ​

VariableOverrides
GRA_CONFIGconfig file path
GRA_BOT_TOKENbot_token
GRA_DB_PATHdb_path
GRA_TICK_SECStick_secs
GRA_LOG_LEVELlog_level
GRA_LOG_FILElog_file (empty = stderr)
GRA_ALLOWED_USER_IDSallowed_user_ids (comma separated)

CLI flags ​

gra [--config FILE] [--bot-token TOKEN] [--db-path PATH] [--tick-secs N]
    [--log-level FILTER] [--log-file FILE] [--allowed-users IDS] [COMMAND]

Flags are global, so they also apply to subcommands such as gra doctor. Run gra --help for details.

Released under the MIT License. Not affiliated with Instagram or Meta.