Skip to content

feat: add coder logout command #1609

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

Merged
merged 1 commit into from
May 19, 2022
Merged

feat: add coder logout command #1609

merged 1 commit into from
May 19, 2022

Conversation

f0ssel
Copy link
Contributor

@f0ssel f0ssel commented May 19, 2022

A coder logout command is useful so users do not have to find and delete the session files manually.

@f0ssel
Copy link
Contributor Author

f0ssel commented May 19, 2022

Closes #1606

@f0ssel f0ssel requested a review from a team May 19, 2022 22:36
@f0ssel f0ssel enabled auto-merge (squash) May 19, 2022 22:40
@f0ssel f0ssel merged commit 077f16c into main May 19, 2022
@f0ssel f0ssel deleted the f0ssel/logout branch May 19, 2022 22:42
Short: "Remove local autheticated session",
RunE: func(cmd *cobra.Command, args []string) error {
config := createConfig(cmd)
err := os.RemoveAll(string(config))
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I'm just paranoid, but I think this should only remove config.Session(), config.URL() and config.Organization(), and not any other files that happen to have ended up in the directory (at least not without confirmation). I would be worried that a misconfigured CODER_CONFIG_DIR could lead to somebody accidentally wiping out their home directory.

See e.g. ValveSoftware/steam-for-linux#3671

Copy link
Member

Choose a reason for hiding this comment

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

I totally agree, we shouldn't delete the folder. I wouldn't put it past that some users are storing a url.bak or session.bak. Or any other related material really that they've cooked up themselves.

func logout() *cobra.Command {
return &cobra.Command{
Use: "logout",
Short: "Remove local autheticated session",
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: s/autheticated/authenticated/

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.

4 participants