Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
SunWuyuan committed Nov 5, 2023
1 parent f3f94a4 commit 3ee6a0f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
11 changes: 9 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,15 @@ WalineServerURL='' #waline的服务器链接
txcid=''
txckey=''

#前端静态文件地址,无法全部修改,请使用替换
staticurl='https://registry.npmmirror.com/ourworldstaticfile/latest/files'
#前端静态文件地址
localstatic=false #是否使用本地静态文件
staticurl='https://registry.npmmirror.com/ourworldstaticfile/latest/files' #静态文件地址

#使用本地数据示例,请将https://github.com/OurWorldOrg/StaticFile下载到项目目录中(与build,node_modules同级),并修改文件夹名称为staticpath的值(默认是static,也可以修改staticpath的值)
#使用时请注释掉上方内容(从前端静态文件地址到此处),因为环境变量不可以重复
# localstatic=true #是否使用本地静态文件
# staticurl='/static' #无需修改,当然也可以随便改成别的
# staticpath='static' #静态文件在服务器上的相对地址(相对于项目根目录)

#附加代码
#可以添加任何代码,如需要添加统计代码,请在此处添加
Expand Down
6 changes: 3 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ app.set("view engine", "ejs");
var DB = require("./server/lib/database.js");

//设置静态资源路径
app.use("/", express.static("build"));
app.use("/", express.static("data")); //用户数据内容

if (process.env.localstatic == 'true') {
app.use(process.env.staticurl, express.static(process.env.staticpath));
}
//全局变量
global.dirname = __dirname;

Expand Down
1 change: 1 addition & 0 deletions static
Submodule static added at 6e7423

0 comments on commit 3ee6a0f

Please sign in to comment.