diff --git a/.changeset/bold-trees-relate.md b/.changeset/bold-trees-relate.md new file mode 100644 index 00000000..89c57f65 --- /dev/null +++ b/.changeset/bold-trees-relate.md @@ -0,0 +1,5 @@ +--- +"@varlock/1password-plugin": patch +--- + +pass through USER and HOME to op cli calls diff --git a/packages/plugins/1password/src/cli-helper.ts b/packages/plugins/1password/src/cli-helper.ts index ab34224d..571668f1 100644 --- a/packages/plugins/1password/src/cli-helper.ts +++ b/packages/plugins/1password/src/cli-helper.ts @@ -202,9 +202,14 @@ async function executeReadBatch(batchToExecute: NonNullable) // because otherwise we'll have trouble dealing with values that contain newlines await spawnAsync('op', `run --no-masking ${lockCliToOpAccount ? `--account ${lockCliToOpAccount} ` : ''}-- env -0`.split(' '), { env: { - // have to pass through at least path so it can find `op`, but might need other items too? + // have to pass a few things through at least path so it can find `op` and related config files PATH: process.env.PATH!, - // ...process.env as any, + ...process.env.USER && { USER: process.env.USER }, + ...process.env.HOME && { HOME: process.env.HOME }, + ...process.env.XDG_CONFIG_HOME && { XDG_CONFIG_HOME: process.env.XDG_CONFIG_HOME }, + // this setting actually just enables the CLI + Desktop App integration + // which in some cases op has a hard time detecting via app setting + OP_BIOMETRIC_UNLOCK_ENABLED: 'true', ...envMap, }, })