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

Change to HOME isn't respected #3

Open
kmluck opened this issue Oct 10, 2023 · 0 comments
Open

Change to HOME isn't respected #3

kmluck opened this issue Oct 10, 2023 · 0 comments

Comments

@kmluck
Copy link

kmluck commented Oct 10, 2023

I don't want to create the .config/godaddy/credentials.json under the user's HOME directory, so I created it elsewhere and then in a subshell expected the change to HOME would be respected. Unfortunately, it didn't work. Looking at https://github.com/cabemo/godaddy-cli/blob/main/internal/config/config.go, I can see that it is actually getting the user.Current().HomeDir; not specifically the HOME environment variable. So even if the HOME environment variable changes, the program doesn't care. Here is a quick BASH script to illustrate the problem:

# Assume that HOME is initially /root
# Assume that the godaddy executable is in the working directory and is executable
# Assume that GODADDY_API_KEY contains a valid GoDaddy API key
# Assume that GODADDY_API_SECRET contains a valid GoDaddy API secret
mkdir -p /tmp/.config/godaddy
jq -n '$ARGS.named' \
  --arg key "${GODADDY_API_KEY}" \
  --arg secret "${GODADDY_API_SECRET}" > /tmp/.config/godaddy/credentials.json

# Assume that the domain acme.com is manageable by the GoDaddy account associated with the previously-set credentials
# I expect the following to work, but it fails to read credentials.json
(export HOME=/tmp ; ./godaddy records list --domain acme.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

No branches or pull requests

1 participant