Update config.ts
This commit is contained in:
1 parent
f73e57ddfe
commit
62dbbdcae3
1 file changed
+4
-3
@@ -2,9 +2,10 @@ import path from "path";
|
||||
import os from "os";
|
||||
|
||||
// 支持环境变量配置 BLOG_ROOT(Linux 部署)
|
||||
// Docker 部署时,BLOG_ROOT 通过环境变量传入
|
||||
export const BLOG_ROOT = process.env.BLOG_ROOT
|
||||
? path.resolve(process.env.BLOG_ROOT)
|
||||
// Docker 部署时,BLOG_ROOT 通过 Docker 环境变量传入,不要放在 .env 文件中
|
||||
const envBlogRoot = process.env.BLOG_ROOT;
|
||||
export const BLOG_ROOT = envBlogRoot && envBlogRoot.trim()
|
||||
? path.resolve(envBlogRoot)
|
||||
: path.resolve(process.cwd(), "..");
|
||||
|
||||
export const CONTENT_DIR = path.join(BLOG_ROOT, "content", "posts");
|
||||
|
||||
Reference in new issue
Block a user