AgentKit
Tài liệuBộ kitTham chiếu CLIỨng dụng Desktop
BetaBạn đang đọc tài liệu kênh beta (3.0.0-beta.15). Tính năng có thể thay đổi trước bản stable tiếp theo.Chuyển sang stable →

secrets

ak secrets import-env

Nhập hàng loạt bí mật từ một tệp dotenv.

Nhập hàng loạt bí mật từ một tệp dotenv.

Lệnh đọc file dotenv nhưng không sửa file đó. Mỗi key mới được ghi vào backend; --force mới ghi đè value đã có.

Dùng ak secrets import-env với đối số và tùy chọn dưới đây. Phần help nguyên bản giữ nguyên thuật ngữ, cú pháp, tác động và điều kiện thực thi của CLI để đối chiếu chính xác.

Contract và help của lệnh

Bulk-import secrets from a dotenv file

Synopsis

Parse <path> as a minimal dotenv file (KEY=value, KEY="quoted", KEY='quoted', # comments, blank lines) and store one secret per key. <path> must be at most 1 MiB. Values are never printed, logged, or included in --json output — only the imported/skipped counts and (with --verbose) a safe per-line reason are shown. Without --force, a key that already has a stored value is skipped rather than overwritten; --force overwrites instead. Use it when onboarding an existing .env-based project onto the secrets vault.

Effects: Writes one value per imported key to the active backend and updates each key's metadata in ~/.agentkit/secrets/index.json. Never modifies <path> itself.

Exit status: 0 success 2 invalid flags, arguments, an unreadable dotenv file, or one over the 1 MiB import limit 5 backend or index failure

ak secrets import-env <path> [flags]

Examples

  ak secrets import-env ${PATH}                    # skip keys that already exist
  ak secrets import-env ${PATH} --force             # overwrite existing keys too
  ak secrets import-env ${PATH} --verbose --json    # machine-readable per-line detail

Options

      --backend string         Storage backend: keychain (default), file (age-encrypted vault), or memory (dev/test; values and its index are throwaway)
      --force                  Overwrite keys that already have a stored value
  -h, --help                   help for import-env
      --json                   Emit machine-readable JSON (implies --no-interactive)
      --no-interactive         Disable interactive prompts (CI-safe)
  -q, --quiet                  Suppress non-error output on stderr
      --unlock-with-recovery   Open the file backend's vault with a recovery private key and set a new passphrase
  -V, --verbose                Extra diagnostic output on stderr (loses to --quiet)
  -y, --yes                    Assume yes for all prompts

SEE ALSO

  • ak secrets - Manage named secret values (API keys, tokens)