Browse Source

v1.0.0

master v1.0.0
hole-thu 3 years ago
parent
commit
4ed92568d8
  1. 10
      .env.sample
  2. 19
      README.md

10
.env.sample

@ -0,0 +1,10 @@
MAST_BASE_URL="https://thu.closed.social/"
MAST_CLIENT="<your client id>"
MAST_SECRET="<your client key>"
MAST_SCOPE="read:accounts"
DATABASE_URL="postgres://hole:hole_pass@localhost/hole_v2"
MIGRATION_DIRECTORY=migrations/postgres
REDIS_URL="redis://127.0.0.1:6379"
ROCKET_DATABASES='{pg_v2={url="postgres://hole:hole_pass@localhost/hole_v2"}}'
RUST_LOG=debug

19
README.md

@ -1,16 +1,15 @@
# hole-backend-rust
# hole-backend-rust v1.0.0
## 部署
以下内容假设你使用 Ubuntu 20.04
*以下内容假设你使用 Ubuntu 20.04*
目前只支持postgresql,对支持sqlite的追踪见 issue #1
安装postgresql (略)
安装redis-server (略)
安装redis (略)
### 准备数据库
@ -20,7 +19,7 @@
sudo -u postgres psql
```
执行:
执行 (替换`'hole_pass'`为实际希望使用的密码):
```postgresql
postgres=# CREATE USER hole WITH PASSWORD 'hole_pass';
@ -35,8 +34,12 @@ hole_v2=# \q
```
### 运行
创建 .env 文件,写入必要的环境变量。可参考 .env.sample。
#### 基于二进制文件
从[release](https://git.thu.monster/newthuhole/hole-backend-rust/releases)直接下载二进制文件
```
./hole-thu --init-database
./hole-thu
@ -59,3 +62,9 @@ cargo run --release
diesel migration run
cargo run --release
```
### 关于账号系统
+ 如果你希望使用自己的登录系统,将 `/_login/` 路径交由另外的后端处理,只需最终将用户名和token写入users表,并跳转到 `/?token=<token>`
+ 如果你希望也使用闭社提供的授权来维护账号系统,使用 `https://thu.closed.social/api/v1/apps` 接口创建应用,并在.env或环境变量中填入client与secret。此操作不需要闭社账号。详情见[文档](https://docs.joinmastodon.org/client/token/#app)。

Loading…
Cancel
Save