Skip to main content

使用env-file配置

本地配置尽量都走 env 文件,方便区分本地开发、测试、生产环境不同的配置环境。 这里使用.env作为本地开发配置,.env.prod作为生产环境配置。为了安全需要,这两个文件都加入到.gitignore中。

指定 env 文件

启用.env.prod,并将 strapi 的环境变量设置为production

ENV_PATH=.prod.env NODE_ENV=production npm start