Skip to content

feat: env-var credentials for Google Sheets (varlock-friendly)#44

Draft
corriander wants to merge 2 commits into
mainfrom
feat/env-var-credentials
Draft

feat: env-var credentials for Google Sheets (varlock-friendly)#44
corriander wants to merge 2 commits into
mainfrom
feat/env-var-credentials

Conversation

@corriander

Copy link
Copy Markdown
Owner

Summary

Adds environment-variable credential support to the Google Sheets integration so the service-account key can be injected at run time (e.g. by varlock from 1Password) instead of living on disk.

  • GSheetsFacade now authorizes from VDD_GSHEETS_CREDENTIALS (the service-account JSON content, not a path) when the variable is set and non-empty; otherwise it falls back to the existing platformdirs.user_config_dir('vdd')/gsheets_credentials.json file unchanged.
  • Uses pygsheets 2.0.6's native authorize(service_account_env_var=...), which json-decodes the named env var and builds service_account.Credentials.from_service_account_info. No new dependencies.
  • Ships a repo-root .env.schema for varlock: 1Password op() resolver, declared @sensitive + @required, with placeholder vault/item/field for you to fill in. varlock is your dev tooling and is deliberately not a dependency of vdd.
  • Documents the precedence, the varlock run -- ... pattern, and the OS-dependent file-fallback path (~/.config/vdd on Linux vs ~/Library/Application Support/vdd on macOS) in docs/gsheets-integration.md.

Testing

  • uv run --frozen pytest — 158 passed (154 baseline + 4 new tests covering env-var precedence, empty-value fallback, file fallback, and client caching).

Notes

  • pyproject.toml / uv.lock untouched.

🤖 Generated with Claude Code

corriander and others added 2 commits July 13, 2026 20:39
Support supplying the Google service-account key via the
VDD_GSHEETS_CREDENTIALS environment variable (JSON content, not a
path). When set and non-empty it takes precedence over the on-disk
credentials file; otherwise the existing file path is used unchanged.

pygsheets 2.0.6 natively supports this via authorize(
service_account_env_var=...), which json-decodes the named env var and
builds service_account.Credentials.from_service_account_info.

Also ship a repo-root varlock .env.schema (1Password op() resolver,
sensitive+required) so the key can be injected at run time without
touching disk, and document the pattern plus the OS-dependent
file-fallback path in docs/gsheets-integration.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Latest @varlock/1password-plugin is 2.0.0 (peer: varlock ^1.8.0) with
identical decorator syntax. Standalone varlock installs download the
exact pinned version from npm, so the pin matters; note in the schema
how to adjust it for older varlock versions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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