CLI
pip install streamwright-console adds streamwright console (sw console) to the StreamWright CLI.
streamwright console CONSOLE_YAML [logging options]
streamwright console migrate [--url URL] [CONSOLE_YAML]
streamwright console users list|add|password|remove [USER] [--name NAME] [--url URL] [CONSOLE_YAML] [--json]
streamwright console
Serves the page and API for the clients CONSOLE_YAML lists, until stopped. Exit status 2 means console.yaml cannot
be used (each problem is logged).
| Option | What it does |
|---|---|
CONSOLE_YAML | The console: the clients, their state databases and who may see them (console.yaml) |
| Logging options | --log-level, --log, --log-format, --log-config, --log-max-chars, after the file: see Logging options |
streamwright validate console.yaml
streamwright console console.yaml --log-format json # http://127.0.0.1:8090
streamwright console migrate
Creates the console's own tables (sw_console_users, sw_console_migrations) in its database, or upgrades them. It
is safe to run again, and concurrent runs wait for one another.
| Option | What it does |
|---|---|
--url URL | The console's database, as a user that may change its tables: sqlite:///PATH (relative to where you run the command), postgresql://...?schema=NAME or mysql://... |
CONSOLE_YAML | Instead of --url: the database console.yaml's auth.login.users names, when the console's own user may change its tables (a SQLite file, say) |
streamwright console users
The console users: the people who sign in with a name and password.
| Action | What it does |
|---|---|
list [--json] | The users: id, name, when added and last changed (--json: one object per line) |
add USER --name NAME | Add a user: asks the password twice on a terminal (else reads stdin's first line) and stores only its scrypt hash |
password USER | Set a user's password: their sessions end within a minute |
remove USER | Remove a user: their sessions end within a minute |
Each takes --url URL or CONSOLE_YAML, as migrate does. USER is what the person signs in with: 1-64 letters,
digits and . _ @ -.
URL="postgresql://admin@admin-db/admin?schema=console"
streamwright console migrate --url "$URL"
streamwright console users add alice --name "Alice Smith" --url "$URL"
streamwright console users list --url "$URL"
migrate and users exit with 0 when done, 1 when the database refused or the user does not exist, and 2 for
invalid input.