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

VSCode always asks for API key after starting the docker container #315

Open
yudi-azvd opened this issue Dec 4, 2022 · 9 comments
Open

Comments

@yudi-azvd
Copy link

yudi-azvd commented Dec 4, 2022

I run

docker compose up -d

I open vscode and it asks me for the key:

image

Is there a way to save it on my machine so that the wakatime extension can read it from inside even for a remote workspace? Or any other way.

By remote workspace I mean I'm using VSCode connected to a docker container using the Dev Containers extension. This container runs in my local machine

@alanhamlett
Copy link
Member

Possibly related to #180?

@yudi-azvd
Copy link
Author

Yes it is related. I was searching the issues but I couldnt find. Thats why I opened this issue

I tried the suggestion in #180 (comment) but it didn't work:

[settings]
api_key = ...
standalone = false
alpha = true

# I've also tried like this:
standalone = false
alpha = true

[settings]
api_key = ...

None of this worked.

Should i move this to #180 and close this issue? Also, is there any logs I can provide?

@alanhamlett
Copy link
Member

The standalone config option was removed in 17.0.0 and currently alpha is the same as stable because wakatime-cli has no pending alpha releases, so you can remove both those config lines.

Let's leave this open since #180 is already closed. Does adding your api key to a ~/.wakatime.cfg file in your container and your host machine make it stop prompting?

@yudi-azvd
Copy link
Author

yudi-azvd commented Dec 7, 2022

I don't think so. If I cat ~/.wakatime.cfg from inside my container it shows my API key. And when I reload the VSCode it still asks for the key.

@alanhamlett
Copy link
Member

Oh, looks like this is related to #280?

@yudi-azvd
Copy link
Author

yudi-azvd commented Dec 8, 2022

Yeah, kinda related. Anyway, the suggestion seems to work. I added .vscode/devcontainer.json with the following content:

{
  "mounts": [
    "source=${localEnv:HOME}/.wakatime.cfg,target=/home/dev/.wakatime.cfg,type=bind,consistency=delegated"
  ]
}

For future readers: mind the path at target=.... It should be a path that makes sense in your container.

@alanhamlett thanks for the help 🤓

EDIT: after a few container restarts, VSCOde got back to prompting for the API key 😢 .

@gandarez
Copy link
Member

gandarez commented Dec 8, 2022

We would update the documentation for that scenario.

@yudi-azvd
Copy link
Author

Actually... after executing docker compose down and then docker compose up -d, VSCode stills prompts me for the key.

@nelson6e65
Copy link

I'm not getting request for a new one, but just error instead:
imagen

I have it set in my container's ~/wakatime.cfg, manually:
imagen

Also, I added as a global in setting.json:
imagen

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

4 participants