Skip to content

config

The config command group provides subcommands for viewing, editing, and validating your configuration.

SubcommandDescription
showDisplay current configuration
editOpen config in your editor
validateValidate configuration syntax
setSet configuration values
pushSynchronize domain states based on schedules
diffShow differences between local and remote NextDNS
pullFetch domains from NextDNS and update local config

Display the current configuration in a readable format.

Terminal window
nextdns-blocker config show
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)

Open the configuration file in your text editor.

Terminal window
nextdns-blocker config edit
  1. Opens config.json in your configured editor
  2. Falls back to $EDITOR environment variable
  3. Falls back to nano, vim, or notepad (Windows)
Terminal window
# Set in config
nextdns-blocker config set editor code
# Or via environment variable
export EDITOR=vim

Changes take effect on the next sync (within 2 minutes) or immediately if you run:

Terminal window
nextdns-blocker config push

Validate the configuration file syntax and structure.

Terminal window
nextdns-blocker config validate
Configuration valid ✓
Summary:
Blocklist: 3 domains
Allowlist: 1 domain
Timezone: America/New_York
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, sunday
CheckDescription
JSON syntaxValid JSON format
Required fieldsDomain, version
Domain formatValid domain names
Schedule formatValid days and times
Time formatHH:MM (24-hour)
Day namesLowercase weekday names
Unblock delayValid delay values
No duplicatesDomain not in both lists

Set specific configuration values without opening an editor.

Terminal window
nextdns-blocker config set KEY VALUE
KeyValuesDescription
timezoneIANA timezoneSchedule evaluation timezone
editorEditor commandEditor for config edit
Terminal window
# Set timezone
nextdns-blocker config set timezone America/Los_Angeles
# Set editor
nextdns-blocker config set editor vim
nextdns-blocker config set editor "code --wait"
nextdns-blocker config set editor nano
Terminal window
# US timezones
nextdns-blocker config set timezone America/New_York
nextdns-blocker config set timezone America/Chicago
nextdns-blocker config set timezone America/Denver
nextdns-blocker config set timezone America/Los_Angeles
# Europe
nextdns-blocker config set timezone Europe/London
nextdns-blocker config set timezone Europe/Paris
nextdns-blocker config set timezone Europe/Berlin
# Asia
nextdns-blocker config set timezone Asia/Tokyo
nextdns-blocker config set timezone Asia/Shanghai
# Other
nextdns-blocker config set timezone UTC

See Timezone Configuration for more details.

The primary command for synchronizing domain states based on configured schedules.

Terminal window
nextdns-blocker config push [OPTIONS]
OptionDescription
--dry-runPreview changes without applying them
-v, --verboseShow detailed output
--helpShow help message
Terminal window
# Basic push
nextdns-blocker config push
# Preview changes
nextdns-blocker config push --dry-run
# Verbose output
nextdns-blocker config push -v

See push command reference for complete documentation.

Show differences between your local config.json and the current state of your NextDNS denylist and allowlist.

Terminal window
nextdns-blocker config diff [OPTIONS]
OptionDescription
--jsonOutput in JSON format
--config-dir PATHConfig directory (default: auto-detect)
Terminal window
nextdns-blocker config diff
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 sync
SymbolMeaning
+Exists in NextDNS but not in local config
-Exists in local config but not in NextDNS
=Exists in both (in sync)
Terminal window
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}
}
}

Fetch domains from NextDNS and update your local config.json. Useful for syncing changes made directly in the NextDNS dashboard to your local configuration.

Terminal window
nextdns-blocker config pull [OPTIONS]
OptionDescription
--dry-runPreview changes without applying
--mergeMerge with existing, preserving metadata
-y, --yesSkip confirmation prompt
--config-dir PATHConfig directory (default: auto-detect)

Replaces local blocklist/allowlist with remote state:

Terminal window
nextdns-blocker config pull

Warning: This removes all local metadata (schedules, unblock delays, locked status).

Adds new domains from remote without removing existing ones:

Terminal window
nextdns-blocker config pull --merge

This preserves:

  • Existing domain metadata (schedules, delays)
  • Locked items
  • Local-only domains
Terminal window
# Preview what would change
nextdns-blocker config pull --dry-run
# Merge new domains, keep existing settings
nextdns-blocker config pull --merge
# Overwrite without confirmation
nextdns-blocker config pull -y
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 NextDNS

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.

A backup is automatically created before modifying config:

Backup: /Users/you/.config/nextdns-blocker/.config.json.backup.20240115_143000

Only the 3 most recent backups are kept.

PlatformPath
macOS/Linux~/.config/nextdns-blocker/config.json
Windows%APPDATA%\nextdns-blocker\config.json
{
"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.

Run the setup wizard:

Terminal window
nextdns-blocker init

Use a JSON validator:

Terminal window
python3 -m json.tool config.json

Or use jsonlint.com.

Set your editor explicitly:

Terminal window
nextdns-blocker config set editor nano

Or set the $EDITOR environment variable in your shell profile.

Force a sync:

Terminal window
nextdns-blocker config push

Or check for validation errors:

Terminal window
nextdns-blocker config validate