2023-06-18 22:27:08 +05:30
|
|
|
# Yggdrasil
|
|
|
|
Self-hosted Minecraft authentication server with authlib-injector support
|
|
|
|
|
|
|
|
# Setup
|
|
|
|
1. Declare database URL
|
|
|
|
```sh
|
|
|
|
$ export DATABASE_URL="sqlite:yggdrasil.db"
|
|
|
|
```
|
2023-06-18 23:28:50 +05:30
|
|
|
1.5 Create .env
|
|
|
|
```sh
|
|
|
|
echo 'DATABASE_URL="sqlite:yggdrasil.db" >> .env'
|
|
|
|
```
|
2023-06-18 22:27:08 +05:30
|
|
|
2. Create database (install sqlx cli tool if not already)
|
|
|
|
```sh
|
|
|
|
$ sqlx db create
|
|
|
|
```
|
|
|
|
3. Run SQL migrations (this creates the tables)
|
|
|
|
```sh
|
|
|
|
$ sqlx migrate run
|
|
|
|
```
|
|
|
|
|
2023-06-21 14:02:19 +05:30
|
|
|
# Yggdrasil Server
|
|
|
|
- Run convenience script `./yggdrasil`
|
|
|
|
- OR `DATABASE_URL=<url> cargo run --bin yggdrasil`
|
|
|
|
|
|
|
|
# Database tool (dbtool)
|
|
|
|
- Run convenience script `./dbtool`
|
|
|
|
- OR `DATABASE_URL=<url> cargo run --bin dbtool`
|
|
|
|
|
|
|
|
## Available commands
|
|
|
|
- `add-account`: Creates a new account
|
|
|
|
- Email (`email@example.com`)
|
|
|
|
- Language (`en-us`)
|
|
|
|
- Country (`US`)
|
|
|
|
|
|
|
|
- `add-profile`: Creates a new profile for an account
|
|
|
|
- Email (`email@example.com`) (Must match existing account)
|
|
|
|
- Username (`EpicMinecrafter4000`)
|
|
|
|
|
|
|
|
- `attach-profile`: Attaches a specific profile to an account
|
|
|
|
- Account ID (`5`) (Must match existing account)
|
|
|
|
- Profile ID (`3`) (Must match existing profile)
|
|
|
|
|
|
|
|
- `del-account`: Deletes an account
|
|
|
|
- Account ID (`5`)
|
|
|
|
|
|
|
|
- `del-profile`: Deletes a profile
|
|
|
|
- Profile ID (`3`)
|
|
|
|
|
|
|
|
- `search`: Search for a specific profile or account
|
|
|
|
- Search type (`account-id`, `profile-id`, `email` (account), `name` (profile), `uuid` (profile))
|
|
|
|
- Query (Can have multiple)
|
|
|
|
|
|
|
|
- `dump`: Dumps a table in the database (Mostly for debug)
|
|
|
|
- Table name (`accounts`, `profiles`, `sessions`, `tokens`)
|