Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expand secret-file path #977

Merged
merged 1 commit into from
May 17, 2021
Merged

expand secret-file path #977

merged 1 commit into from
May 17, 2021

Conversation

alexcb
Copy link
Collaborator

@alexcb alexcb commented May 12, 2021

Typically the shell will expand paths such as ~/foo; however when given
as an argument to --secret-file secret=~/foo, the shell did not expand
this path. This addresses this issue.

Signed-off-by: Alex Couture-Beil alex@earthly.dev

Typically the shell will expand paths such as ~/foo; however when given
as an argument to --secret-file secret=~/foo, the shell did not expand
this path. This addresses this issue.

Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
@alexcb alexcb marked this pull request as ready for review May 12, 2021 18:29
@alexcb alexcb requested review from dchw and vladaionescu May 12, 2021 18:29
return homeDir, nil, err
}
// See if SUDO_USER exists. Use that user's home dir.
sudoUserName, ok := os.LookupEnv("SUDO_USER")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @dchw had a nice function for fetching the current user or sudo user in his PR. Might be worth merging them somehow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code came from the cliutil.DetectHomeDir() function; If we can fold more code into using this function that sounds like a good plan.

)

// GetUserHomeDirs returns a map of all users and their homedirs
func GetUserHomeDirs() (map[string]string, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that this is too much logic for what is normally needed... but hey... I guess it's now already written.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code was moved here from our autocompletion.getUsers(), no new code was written in this PR for this function.

@alexcb alexcb merged commit 8923576 into main May 17, 2021
@alexcb alexcb deleted the expand-secret-file-path branch May 17, 2021 18:11
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.

None yet

2 participants