Skip to content

Commit

Permalink
去掉配置文件改为环境变量
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerry committed Apr 24, 2024
1 parent 2f53b85 commit e7768a5
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 23 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ COPY --from=builder /app/.output /app/.output
COPY --from=builder /app/prisma /app/prisma
COPY --from=builder /app/start.sh /app/start.sh
COPY --from=builder /app/version /app/version
COPY --from=builder /app/.env /app/.env

RUN mkdir -p /app/data/upload

Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@ S3兼容的对象存储配置方法(不是必须的,只有你需要把图片存

## 自定义其他配置

鉴于萝卜青菜各有所爱,每个人情况不一致,特此使用配置文件配置各项特性化需求,目前支持的所有配置见[这里](https://github.com/kingwrcy/moments/blob/master/.env)

### 使用方法

复制项目根目录下的.env文件,随便你起什么名字,在docker启动时把文件挂载进去,挂载的路径为`/app/.env`

`/app/.env`文件中的配置优先级最高!
鉴于萝卜青菜各有所爱,每个人情况不一致,特此使用配置文件配置各项特性化需求,目前支持的所有环境变量配置见[这里](https://github.com/kingwrcy/moments/blob/master/.env)


## 使用google recaptchaV3(可选)
Expand Down
2 changes: 1 addition & 1 deletion components/FriendsCommentInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const submitComment = async (token?: string) => {
content.value = ''
emit('commentAdded')
} else {
toast.warning('评论失败')
toast.warning(res.message || '评论失败')
}
pending.value = false
}
Expand Down
14 changes: 0 additions & 14 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,4 @@ mkdir -p /app/data/upload
npx prisma migrate deploy

export VERSION=$(cat /app/version)

ENV_FILE="/app/.env"

grep -v -e '^#' -e '^$' "$ENV_FILE" | while IFS='=' read -r key value; do
if [ -z "$key" ] || [ -z "$value" ]; then
continue
fi

if ! declare -p "$key" &>/dev/null; then
echo "Setting $key=$value"
export "$key=$value"
fi
done

node /app/.output/server/index.mjs > output.log 2>&1

0 comments on commit e7768a5

Please sign in to comment.