Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document more mas-cli subcommands and standardise the format #3988

Merged
merged 3 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- [`database`](./reference/cli/database.md)
- [`manage`](./reference/cli/manage.md)
- [`server`](./reference/cli/server.md)
- [`worker`](./reference/cli/worker.md)
- [`templates`](./reference/cli/templates.md)
- [`doctor`](./reference/cli/doctor.md)

Expand Down
9 changes: 9 additions & 0 deletions docs/reference/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ Valid levels from least to most verbose are `error`, `warn`, `info`, `debug` and
Sets the configuration file to load.
It can be repeated multiple times to merge multiple files together.

### `--help`

Print out help instructions.

### `--version`

Print the mas cli version.

---

```
Expand All @@ -33,4 +41,5 @@ Commands:
Options:
-c, --config <CONFIG> Path to the configuration file
-h, --help Print help
-V, --version Print version
```
4 changes: 4 additions & 0 deletions docs/reference/cli/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Helps to deal with the configuration

Global options:
- `--config <config>`: Path to the configuration file.
- `--help`: Print help.

## `config check`

Check the validity of configuration files.
Expand Down
8 changes: 6 additions & 2 deletions docs/reference/cli/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

Run database-related operations

Global options:
- `--config <config>`: Path to the configuration file.
- `--help`: Print help.

## `database migrate`

Run the pending database migrations
Run the pending database migrations.

```
$ mas-cli database migrate
```
```
8 changes: 7 additions & 1 deletion docs/reference/cli/doctor.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# `doctor`

Global options:
- `--config <config>`: Path to the configuration file.
- `--help`: Print help.

## `doctor`

Run diagnostics on the live deployment.
This tool should help diagnose common issues with the service configuration and deployment.

When running this tool, make sure it runs from the same point-of-view as the service, with the same configuration file and environment variables.

```
$ mas-cli doctor
```
```
103 changes: 100 additions & 3 deletions docs/reference/cli/manage.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,104 @@
# `manage`

Includes admin-related subcommands.

## `manage verify-email <username> <email>`
The MAS CLI provides several subcommands for managing users and configurations

Mark a user email address as verified
Global options:
- `--config <config>`: Path to the configuration file.
- `--help`: Print help.

## `manage add-email`

Add an email address to the specified user.

```
$ mas-cli manage add-email <username> <email>
```

## `manage verify-email`

[DEPRECATED] Mark an email address as verified.

```
$ mas-cli manage verify-email <username> <email>
```

## `manage set-password`

Set a user password.

Options:
- `--ignore-complexity`: Don't enforce that the password provided is above the minimum configured complexity.

```
$ mas-cli manage set-password <username> <password> --ignore-complexity
```

## `manage issue-compatibility-token`

Issue a compatibility token for a user.

Options:
- `--device-id <device_id>`: Device ID to set in the token. If not specified, a random device ID will be generated.
- `--yes-i-want-to-grant-synapse-admin-privileges`: Whether the token should be given admin privileges.

```
$ mas-cli manage issue-compatibility-token <username> --device-id <device_id> --yes-i-want-to-grant-synapse-admin-privileges
```

## `manage provision-all-users`

Trigger a provisioning job for all users.

```
$ mas-cli manage provision-all-users
```

## `manage kill-sessions`

Kill all sessions for a user.

Options:
- `--dry-run`: Do a dry run, ie see which sessions would be killed.

```
$ mas-cli manage kill-sessions <username> --dry-run
```

## `manage lock-user`

Lock a user.

Options:
- `--deactivate`: Whether to deactivate the user.

```
$ mas-cli manage lock-user <username> --deactivate
```

## `manage unlock-user`

Unlock a user.

```
$ mas-cli manage unlock-user <username>
```

## `manage register-user`

Register a user. This will interactively prompt for the user's attributes unless the `--yes` flag is set. It bypasses any policy check on the password, email, etc.

Options:
- `--username <username>`: Username to register.
- `--password <password>`: Password to set.
- `--email <email>`: Email to add. Can be specified multiple times.
- `--upstream-provider-mapping <UPSTREAM_PROVIDER_ID:SUBJECT>`: Upstream OAuth 2.0 provider mapping. Can be specified multiple times.
- `--admin`: Make the user an admin.
- `--no-admin`: Make the user not an admin.
- `--yes`: Don't ask questions, just do it.
- `--display-name <display_name>`: Set the user's display name.
- `--ignore-password-complexity`: Don't enforce that the password provided is above the minimum configured complexity.

```
$ mas-cli manage register-user
```
11 changes: 11 additions & 0 deletions docs/reference/cli/server.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# `server`

Global options:
- `--config <config>`: Path to the configuration file.
- `--help`: Print help.

## `server`

Runs the authentication service.

Options:
- `--no-migrate`: Do not apply pending database migrations on start.
- `--no-worker`: Do not start the task worker.
- `--no-sync`: Do not sync the configuration with the database.

```
$ mas-cli server
INFO mas_cli::server: Starting task scheduler
Expand Down
4 changes: 4 additions & 0 deletions docs/reference/cli/templates.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# `templates`

Global options:
- `--config <config>`: Path to the configuration file.
- `--help`: Print help.

## `templates check`

Check the validity of the templates loaded by the config.
Expand Down
13 changes: 13 additions & 0 deletions docs/reference/cli/worker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# `worker`

Global options:
- `--config <config>`: Path to the configuration file.
- `--help`: Print help.

## `worker`

Runs the authentication service worker.

```
$ mas-cli worker
```
Loading