|
| 1 | +--- |
| 2 | +title: Server Commands |
| 3 | +linkTitle: Commands |
| 4 | +description: Dnote server CLI commands |
| 5 | +weight: 3 |
| 6 | +--- |
| 7 | + |
| 8 | +The Dnote server provides CLI commands for managing your server instance and users. |
| 9 | + |
| 10 | +## Start Server |
| 11 | + |
| 12 | +Start the Dnote server: |
| 13 | + |
| 14 | +```bash |
| 15 | +dnote-server start |
| 16 | +``` |
| 17 | + |
| 18 | +See [Configuration](../configuration/) for available flags and environment variables. |
| 19 | + |
| 20 | +## User Management |
| 21 | + |
| 22 | +### Create User |
| 23 | + |
| 24 | +Create a new user account: |
| 25 | + |
| 26 | +```bash |
| 27 | +dnote-server user create --email=user@example.com --password=yourpassword |
| 28 | +``` |
| 29 | + |
| 30 | +**Flags:** |
| 31 | +- `--email` - User email address (required) |
| 32 | +- `--password` - User password (required, minimum 8 characters) |
| 33 | +- `--dbPath` - Path to database file (optional, defaults to `$XDG_DATA_HOME/dnote/server.db`) |
| 34 | + |
| 35 | +**Example with custom database path:** |
| 36 | + |
| 37 | +```bash |
| 38 | +dnote-server user create \ |
| 39 | + --dbPath=/var/lib/dnote/server.db \ |
| 40 | + --email=user@example.com \ |
| 41 | + --password=yourpassword |
| 42 | +``` |
| 43 | + |
| 44 | +### Reset Password |
| 45 | + |
| 46 | +Reset a user's password: |
| 47 | + |
| 48 | +```bash |
| 49 | +dnote-server user reset-password --email=user@example.com --password=newpassword |
| 50 | +``` |
| 51 | + |
| 52 | +**Flags:** |
| 53 | +- `--email` - User email address (required) |
| 54 | +- `--password` - New password (required, minimum 8 characters) |
| 55 | +- `--dbPath` - Path to database file (optional) |
| 56 | + |
| 57 | +**Example:** |
| 58 | + |
| 59 | +```bash |
| 60 | +dnote-server user reset-password \ |
| 61 | + --dbPath=/var/lib/dnote/server.db \ |
| 62 | + --email=user@example.com \ |
| 63 | + --password=newpassword123 |
| 64 | +``` |
| 65 | + |
| 66 | +### Remove User |
| 67 | + |
| 68 | +Remove a user account: |
| 69 | + |
| 70 | +```bash |
| 71 | +dnote-server user remove --email=user@example.com |
| 72 | +``` |
| 73 | + |
| 74 | +**Flags:** |
| 75 | +- `--email` - User email address (required) |
| 76 | +- `--dbPath` - Path to database file (optional) |
| 77 | + |
| 78 | +**Example:** |
| 79 | + |
| 80 | +```bash |
| 81 | +dnote-server user remove \ |
| 82 | + --dbPath=/var/lib/dnote/server.db \ |
| 83 | + --email=user@example.com |
| 84 | +``` |
| 85 | + |
| 86 | +**Important:** Users with existing notes or books cannot be removed. Delete all their notes and books first. |
| 87 | + |
| 88 | +## Version |
| 89 | + |
| 90 | +Display the server version: |
| 91 | + |
| 92 | +```bash |
| 93 | +dnote-server version |
| 94 | +``` |
| 95 | + |
| 96 | +## Help |
| 97 | + |
| 98 | +Display help information: |
| 99 | + |
| 100 | +```bash |
| 101 | +# General help |
| 102 | +dnote-server |
| 103 | + |
| 104 | +# Command-specific help |
| 105 | +dnote-server start --help |
| 106 | +dnote-server user |
| 107 | +dnote-server user create --help |
| 108 | +``` |
0 commit comments