📃 feat: add list-balances, remove-user, and improve User scripts (#1418)

* Refactoring opening of DB to config/helpers.js

* Adding two user scripts:

- 'delete-user' to remove a user definitely
- 'list-balances' to show the balances of all the users
This commit is contained in:
Linus Gasser 2023-12-30 19:25:12 +01:00 committed by GitHub
parent 8735db0980
commit 1a95bef677
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 137 additions and 82 deletions

View file

@ -581,6 +581,7 @@ see: **[Token Usage](../../features/token_usage.md)**
- To manually add balances, run the following command:`npm run add-balance`
- You can also specify the email and token credit amount to add, e.g.:`npm run add-balance example@example.com 1000`
- To list the balance of every user: `npm run list-balances`
> **Note:** 1000 credits = $0.001 (1 mill USD)
@ -602,6 +603,7 @@ see: **[User/Auth System](../configuration/user_auth_system.md)**
- `ALLOW_SOCIAL_REGISTRATION`: Enable or disable registration of new user using various social network. Set to `true` or `false` to enable or disable.
> **Quick Tip:** Even with registration disabled, add users directly to the database using `npm run create-user`.
> **Quick Tip:** With registration disabled, you can delete a user with `npm run delete-user email@domain.com`.
```bash
ALLOW_EMAIL_LOGIN=true