Automatically inject provider keys inside VM #2

Open
opened 2025-08-02 14:57:50 +00:00 by glenux · 0 comments
Owner

Load all LLM provider secrets from keys.yml (host side) into the Debian 12 VM during every vagrant up / vagrant provision, so GUI and CLI tools find their keys without manual edits.

Environment

  • Provisioning: single Bash script run by Vagrant
  • Host file: keys.yml (flat YAML)
  • Vars: *_API_KEY, GOOGLE_GENAI_USE_VERTEXAI, etc.
  • In‑VM storage: plaintext /etc/profile.d/provider‑keys.sh and tool-specific configuration files

Flow / Validation

  1. Edit keys.yml.
  2. Run vagrant up (or vagrant provision).
  3. Inside VM: printenv | grep _API_KEY → values present.
  4. Change a key, re‑provision → value updated.

Implementation Sketch

# parse YAML (yq or python -)
yq eval '. as $k | to_entries | .[] | "\(.key)=\(.value)"' keys.yml > /etc/vibe/keys.env
sed 's/^/export /' /etc/vibe/keys.env > /etc/profile.d/provider-keys.sh

Definition of Done

  • Provisioning reads keys.yml and refreshes env files.
  • New shells inherit all keys.
  • README explains keys.yml and re‑provisioning.
Load all LLM provider secrets from **`keys.yml`** (host side) into the Debian 12 VM during every `vagrant up` / `vagrant provision`, so GUI and CLI tools find their keys without manual edits. ## Environment * **Provisioning:** single Bash script run by Vagrant * **Host file:** `keys.yml` (flat YAML) * **Vars:** `*_API_KEY`, `GOOGLE_GENAI_USE_VERTEXAI`, etc. * **In‑VM storage:** plaintext `/etc/profile.d/provider‑keys.sh` and tool-specific configuration files ## Flow / Validation 1. Edit `keys.yml`. 2. Run `vagrant up` (or `vagrant provision`). 3. Inside VM: `printenv | grep _API_KEY` → values present. 4. Change a key, re‑provision → value updated. ## Implementation Sketch ```bash # parse YAML (yq or python -) yq eval '. as $k | to_entries | .[] | "\(.key)=\(.value)"' keys.yml > /etc/vibe/keys.env sed 's/^/export /' /etc/vibe/keys.env > /etc/profile.d/provider-keys.sh ``` ## Definition of Done * Provisioning reads `keys.yml` and refreshes env files. * New shells inherit all keys. * README explains `keys.yml` and re‑provisioning.
glenux added this to the Default project 2025-08-02 15:13:25 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: glenux/gen-ai--vibe-coding--lab#2
No description provided.