27 lines
683 B
Markdown
27 lines
683 B
Markdown
# 环境配置
|
|
|
|
不要把真实数据库密码写入仓库。开发时在当前 shell 中设置环境变量。
|
|
|
|
## API
|
|
|
|
```bash
|
|
export DATABASE_URL="postgres://<user>:<password>@<host>:<port>/shanghai_housing_research_dev"
|
|
export API_HOST="127.0.0.1"
|
|
export API_PORT="8080"
|
|
export RUN_MIGRATIONS="true"
|
|
```
|
|
|
|
`RUN_MIGRATIONS=true` 会在 API 启动时运行 `apps/api/migrations` 中的 SQLx migrations。生产环境建议由单独的 migration job 执行。
|
|
|
|
## 数据库命名
|
|
|
|
建议使用:
|
|
|
|
```text
|
|
shanghai_housing_research_dev
|
|
shanghai_housing_research_test
|
|
shanghai_housing_research
|
|
```
|
|
|
|
管理员账户只用于 bootstrap。应用运行建议使用专用低权限账户。
|