Skip to content

Commit

Permalink
Add support for ~ in age and GCP key/cred paths in sopsrc
Browse files Browse the repository at this point in the history
  • Loading branch information
M1kep committed Dec 19, 2023
1 parent f18721b commit 4046d61
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,10 @@ async function getSopsGeneralOptions() {
}

if (gcpCredentialsPath) {
if (gcpCredentialsPath.startsWith('~')) {
gcpCredentialsPath = path.join(os.homedir(), gcpCredentialsPath.substring(1));
}

if (!path.isAbsolute(gcpCredentialsPath) && vscode.workspace.workspaceFolders) {
for (const workspaceFolder of vscode.workspace.workspaceFolders) {
const gcpCredentialsAbsPath = path.join(workspaceFolder.uri.path, gcpCredentialsPath);
Expand All @@ -545,6 +549,10 @@ async function getSopsGeneralOptions() {
}

if (ageKeyFile) {
if (ageKeyFile.startsWith('~')) {
ageKeyFile = path.join(os.homedir(), ageKeyFile.substring(1));
}

if (!path.isAbsolute(ageKeyFile) && vscode.workspace.workspaceFolders) {
for (const workspaceFolder of vscode.workspace.workspaceFolders) {
const ageKeyFileAbsPath = path.join(workspaceFolder.uri.path, ageKeyFile);
Expand Down

0 comments on commit 4046d61

Please sign in to comment.