config
The config command group provides subcommands for viewing, editing, and validating your configuration.
Subcommands
Section titled “Subcommands”| Subcommand | Description |
|---|---|
show | Display current configuration |
edit | Open config in your editor |
validate | Validate configuration syntax |
set | Set configuration values |
push | Synchronize domain states based on schedules |
diff | Show differences between local and remote NextDNS |
pull | Fetch domains from NextDNS and update local config |
config show
Section titled “config show”Display the current configuration in a readable format.
nextdns-blocker config showOutput
Section titled “Output”Configuration━━━━━━━━━━━━━
Settings: Timezone: America/New_York Editor: vim
Blocklist (3 domains): reddit.com Description: Social media Unblock delay: 30m Schedule: Mon-Fri 12:00-13:00, 18:00-22:00 Sat-Sun 10:00-23:00
twitter.com Description: News Unblock delay: 0 Schedule: Mon-Fri 18:00-22:00 Sat-Sun (always)
gambling-site.com Description: Always blocked Unblock delay: never Schedule: null (always blocked)
Allowlist (1 domain): aws.amazon.com Description: Work resource Schedule: null (always allowed)config edit
Section titled “config edit”Open the configuration file in your text editor.
nextdns-blocker config editBehavior
Section titled “Behavior”- Opens
config.jsonin your configured editor - Falls back to
$EDITORenvironment variable - Falls back to
nano,vim, ornotepad(Windows)
Setting Your Editor
Section titled “Setting Your Editor”# Set in confignextdns-blocker config set editor code
# Or via environment variableexport EDITOR=vimAfter Editing
Section titled “After Editing”Changes take effect on the next sync (within 2 minutes) or immediately if you run:
nextdns-blocker config pushconfig validate
Section titled “config validate”Validate the configuration file syntax and structure.
nextdns-blocker config validateOutput (Success)
Section titled “Output (Success)”Configuration valid ✓
Summary: Blocklist: 3 domains Allowlist: 1 domain Timezone: America/New_YorkOutput (Error)
Section titled “Output (Error)”Configuration error ✗
Line 15: Invalid time format "25:00" Expected format: HH:MM (00:00-23:59)
Line 22: Unknown day name "monnday" Valid days: monday, tuesday, wednesday, thursday, friday, saturday, sundayWhat Gets Validated
Section titled “What Gets Validated”| Check | Description |
|---|---|
| JSON syntax | Valid JSON format |
| Required fields | Domain, version |
| Domain format | Valid domain names |
| Schedule format | Valid days and times |
| Time format | HH:MM (24-hour) |
| Day names | Lowercase weekday names |
| Unblock delay | Valid delay values |
| No duplicates | Domain not in both lists |
config set
Section titled “config set”Set specific configuration values without opening an editor.
nextdns-blocker config set KEY VALUESupported Keys
Section titled “Supported Keys”| Key | Values | Description |
|---|---|---|
timezone | IANA timezone | Schedule evaluation timezone |
editor | Editor command | Editor for config edit |
Examples
Section titled “Examples”# Set timezonenextdns-blocker config set timezone America/Los_Angeles
# Set editornextdns-blocker config set editor vimnextdns-blocker config set editor "code --wait"nextdns-blocker config set editor nanoTimezone Examples
Section titled “Timezone Examples”# US timezonesnextdns-blocker config set timezone America/New_Yorknextdns-blocker config set timezone America/Chicagonextdns-blocker config set timezone America/Denvernextdns-blocker config set timezone America/Los_Angeles
# Europenextdns-blocker config set timezone Europe/Londonnextdns-blocker config set timezone Europe/Parisnextdns-blocker config set timezone Europe/Berlin
# Asianextdns-blocker config set timezone Asia/Tokyonextdns-blocker config set timezone Asia/Shanghai
# Othernextdns-blocker config set timezone UTCSee Timezone Configuration for more details.
config push
Section titled “config push”The primary command for synchronizing domain states based on configured schedules.
nextdns-blocker config push [OPTIONS]Options
Section titled “Options”| Option | Description |
|---|---|
--dry-run | Preview changes without applying them |
-v, --verbose | Show detailed output |
--help | Show help message |
Examples
Section titled “Examples”# Basic pushnextdns-blocker config push
# Preview changesnextdns-blocker config push --dry-run
# Verbose outputnextdns-blocker config push -vSee push command reference for complete documentation.
config diff
Section titled “config diff”Show differences between your local config.json and the current state of your NextDNS denylist and allowlist.
nextdns-blocker config diff [OPTIONS]Options
Section titled “Options”| Option | Description |
|---|---|
--json | Output in JSON format |
--config-dir PATH | Config directory (default: auto-detect) |
Example
Section titled “Example”nextdns-blocker config diffOutput
Section titled “Output” NextDNS Config Diff ━━━━━━━━━━━━━━━━━━
Denylist: + twitter.com (remote only) - reddit.com (local only) = youtube.com (in sync) = instagram.com (in sync) ... and 3 more in sync
Allowlist: + github.com (remote only) = aws.amazon.com (in sync)
Summary: Denylist: 1 local, 1 remote, 5 sync Allowlist: 0 local, 1 remote, 1 syncLegend
Section titled “Legend”| Symbol | Meaning |
|---|---|
+ | Exists in NextDNS but not in local config |
- | Exists in local config but not in NextDNS |
= | Exists in both (in sync) |
JSON Output
Section titled “JSON Output”nextdns-blocker config diff --json{ "blocklist": { "local_only": ["reddit.com"], "remote_only": ["twitter.com"], "in_sync": ["youtube.com", "instagram.com"] }, "allowlist": { "local_only": [], "remote_only": ["github.com"], "in_sync": ["aws.amazon.com"] }, "summary": { "blocklist": {"local": 1, "remote": 1, "sync": 2}, "allowlist": {"local": 0, "remote": 1, "sync": 1} }}config pull
Section titled “config pull”Fetch domains from NextDNS and update your local config.json. Useful for syncing changes made directly in the NextDNS dashboard to your local configuration.
nextdns-blocker config pull [OPTIONS]Options
Section titled “Options”| Option | Description |
|---|---|
--dry-run | Preview changes without applying |
--merge | Merge with existing, preserving metadata |
-y, --yes | Skip confirmation prompt |
--config-dir PATH | Config directory (default: auto-detect) |
Overwrite Mode (Default)
Section titled “Overwrite Mode (Default)”Replaces local blocklist/allowlist with remote state:
nextdns-blocker config pullWarning: This removes all local metadata (schedules, unblock delays, locked status).
Merge Mode
Section titled “Merge Mode”Adds new domains from remote without removing existing ones:
nextdns-blocker config pull --mergeThis preserves:
- Existing domain metadata (schedules, delays)
- Locked items
- Local-only domains
Examples
Section titled “Examples”# Preview what would changenextdns-blocker config pull --dry-run
# Merge new domains, keep existing settingsnextdns-blocker config pull --merge
# Overwrite without confirmationnextdns-blocker config pull -yOutput
Section titled “Output” Pull Summary: Blocklist: +5 added Allowlist: +2 added
Warning: 3 blocklist domains exist locally but not in remote
Config updated Run 'ndb config push' to apply changes to NextDNSProtection
Section titled “Protection”Protected domains (with locked: true or unblock_delay: "never") cannot be removed by pull:
Error: Pull would remove protected domains
Protected blocklist domains: porn (locked)
Tip: Use --merge to add remote domains without removing local ones.Backup
Section titled “Backup”A backup is automatically created before modifying config:
Backup: /Users/you/.config/nextdns-blocker/.config.json.backup.20240115_143000Only the 3 most recent backups are kept.
Configuration File Locations
Section titled “Configuration File Locations”| Platform | Path |
|---|---|
| macOS/Linux | ~/.config/nextdns-blocker/config.json |
| Windows | %APPDATA%\nextdns-blocker\config.json |
Configuration Structure
Section titled “Configuration Structure”{ "version": "1.0", "settings": { "timezone": "America/New_York", "editor": null }, "blocklist": [ { "domain": "example.com", "description": "Optional description", "unblock_delay": "30m", "schedule": { "available_hours": [...] } } ], "allowlist": [ { "domain": "exception.example.com", "description": "Always accessible" } ]}See Configuration Reference for complete documentation.
Troubleshooting
Section titled “Troubleshooting””Configuration file not found”
Section titled “”Configuration file not found””Run the setup wizard:
nextdns-blocker init“Invalid JSON syntax”
Section titled ““Invalid JSON syntax””Use a JSON validator:
python3 -m json.tool config.jsonOr use jsonlint.com.
”Editor not found”
Section titled “”Editor not found””Set your editor explicitly:
nextdns-blocker config set editor nanoOr set the $EDITOR environment variable in your shell profile.
Changes not taking effect
Section titled “Changes not taking effect”Force a sync:
nextdns-blocker config pushOr check for validation errors:
nextdns-blocker config validate