CLI in Development
When you run NexPanel from source, the CLI binary is at ./tmp/main instead of /opt/nexpanel/nexpanel. It behaves the same as the production binary but uses the development database and configuration.
Running Commands
From the project root:
./tmp/main <command> [flags]
For example:
./tmp/main user list
./tmp/main version
The --dev Flag
Pass --dev to any CLI command to target the development database. This is required when running from source, because the CLI otherwise expects the production paths under /opt/nexpanel/.
./tmp/main user list --dev
./tmp/main user reset-password admin --dev
./tmp/main version
The --dev flag is only relevant for development builds. Production installs never need it because they only have one database.
Development Database
- Development:
nexpanel_dev.dbin the project root - Production:
/opt/nexpanel/db/nexpanel.db
Both use the same schema and migrations. The --dev flag simply switches which file the CLI connects to.
Testing Against Production Paths
If you want to test commands as they would run in production, build the binary and run it without --dev:
go build -o ./tmp/nexpanel ./cmd/nexpanel
./tmp/nexpanel user list
This uses the production paths and database. Only do this on a development machine, not on a production server.
Next
- CLI Usage - how the CLI works in production