项目配置
带你如何配置项目
环境变量
项目所有的环境变量统一放在项目根目录下的 .env.xxx.local
中便于进行管理。
开发环境配置示例
# Base
NODE_ENV=development
APP_NAME=FastBuildAI
APP_VERSION=1.0.0
# Server
SERVER_PORT=4090
SERVER_CORS_ENABLED=true
SERVER_CORS_ORIGIN=*
SERVER_SHOW_DETAILED_ERRORS=false
# PM2
PM2_APP_NAME=fastbuildai
# JWT
JWT_SECRET=fastbuildai
JWT_EXPIRES_IN=1d
# Database
DB_TYPE=postgres
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE=fastbuildai
DB_TABLE_PREFIX=fb_
DB_SYNCHRONIZE=true
DB_LOGGING=true
# Redis
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_USERNAME=
REDIS_PASSWORD=
REDIS_DB=0
REDIS_TTL=60*60*24
# Logs
# type LogLevel = "log" | "error" | "warn" | "debug" | "verbose" | "fatal"
LOG_LEVELS=error,warn,debug,fatal
LOG_TO_FILE=true
# Web
VITE_APP_BASE_URL='http://localhost:4090'
VITE_APP_WEB_API_PREFIX=/web
VITE_APP_CONSOLE_API_PREFIX=/console
VITE_APP_SHOP_URL='https://freebuildai-shop.yixiangonline.com'
插件包配置
插件包的基本配置信息统一在插件包根目录下的 manifest.json
中。这个文件会根据插件创建时填的表单信息自动生成,无需自己手动创建。
{
"name": "example-plugin",
"version": "1.0.0",
"title": "示例插件",
"description": "示例插件,用于展示插件包的配置",
"author": "FastBuildAI团队",
"homepage": "https://www.mddai.cn",
"dependencies": {},
"devDependencies": {}
}
在插件包的前后端代码中,会生成带有自身特性的前缀。比如插件后端代码根目录下的 package.json
文件会给包名添加 @server/
前缀:
{
"name": "@server/example-plugin",
"version": "1.0.0",
"title": "示例插件",
"description": "示例插件,用于展示插件包的配置",
"enabled": true,
"author": "FastBuildAI团队",
"homepage": "https://www.mddai.cn",
"dependencies": {},
"devDependencies": {}
}
同理,插件前端代码根目录下的 package.json
文件会给包名添加 @web/
前缀:
{
"name": "@web/example-plugin",
"version": "1.0.0",
"title": "示例插件",
"description": "示例插件,用于展示插件包的配置",
"enabled": true,
"author": "FastBuildAI团队",
"homepage": "https://www.mddai.cn",
"dependencies": {},
"devDependencies": {}
}