Skip to content

compose 的 env_file 指向 isec 渲染文件,不再挂仓内明文 - #31

Merged
zj1123581321 merged 1 commit into
masterfrom
feat/isec-envfile-260922
Sep 21, 2026
Merged

zj1123581321 merged 1 commit into
masterfrom
feat/isec-envfile-260922

Conversation

@zj1123581321

Copy link
Copy Markdown
Collaborator

为什么

本仓的密钥已迁进自建 Infisical,仓里的 .env 会被移走。docker compose 的
env_file: 只认路径、认不了环境变量,文件一没就起不来。

改法

compose 会对整份 YAML 做变量插值,env_file 的路径也在内:

    env_file:
      - "${ISEC_ENV_FILE:?这份配置由 isec 提供,请用 isec docker compose ... 启动}"

isec 会导出 ISEC_ENV_FILE,指向本机 infisical-agent 为该仓渲染出来的密钥文件
(tmpfs,600)。

  • 在 isec 之下 → 解析成该仓的渲染文件路径
  • 不在 isec 之下 → compose 报 required variable ISEC_ENV_FILE is missing 直接退出,
    不会带着一份空配置把服务拉起来

实测

场景 退出码
isec docker compose config --quiet 0
去掉 ISEC_ENV_FILE 后 docker compose config --quiet 非 0

密钥侧已单独核过:渲染文件与原 .env 逐键比对全部一致,键数相等。

对使用者的影响

日常启动从 docker compose up 改成 isec docker compose up。

🤖 Generated with Claude Code

本仓的密钥已经迁进自建 Infisical,仓里的 .env 会被移走。compose 的 env_file:
只认路径、认不了环境变量,所以改成让它读 isec 提供的渲染文件。

compose 会对整份 YAML 做变量插值,env_file 的路径也在内:
  - 在 isec 之下:${ISEC_ENV_FILE} 解析成该仓的渲染文件路径
  - 不在 isec 之下:compose 报 'required variable ISEC_ENV_FILE is missing'
    直接退出,不会带着一份空配置把服务拉起来

两个方向都实测过:isec docker compose config 退出码 0;
去掉 ISEC_ENV_FILE 退出码非 0。

日常启动方式从 docker compose up 改成 isec docker compose up。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Agent-Executor: cc
Agent-Session: 5f6b196e-3278-4b31-8708-72459c886f39
Agent-Effort: high
@zj1123581321
zj1123581321 merged commit 25257da into master Sep 21, 2026
12 checks passed
@zj1123581321
zj1123581321 deleted the feat/isec-envfile-260922 branch September 21, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant