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

Support .config and environment variable for session #8

Closed
ModProg opened this issue Dec 1, 2022 · 6 comments · Fixed by #9 or #10
Closed

Support .config and environment variable for session #8

ModProg opened this issue Dec 1, 2022 · 6 comments · Fixed by #9 or #10

Comments

@ModProg
Copy link
Contributor

ModProg commented Dec 1, 2022

For config dir, you could use: https://docs.rs/dirs/4.0.0/dirs/fn.config_dir.html

And for environment variable, I'd imagine something like ADVENT_OF_CODE_SESSION.

I'd be willing to implement this my self.

@ModProg
Copy link
Contributor Author

ModProg commented Dec 1, 2022

The .config would be on top of the current location to stay backward compatible.

@scarvalhojr
Copy link
Owner

That's a great idea, please feel free to submit a PR. We could have config_dir as default and if not found revert to home dir.

Not so sure about the env var as that could be a little confusing for users (which one takes precedence?) and possibly less safe (if exported as clear text), but happy to consider it too.

I'd suggest two separate PRs to make it easier to review.

@ModProg
Copy link
Contributor Author

ModProg commented Dec 2, 2022

The environment variable was actually meant to enable one to use tools that support storing env variables on the keychain.

@scarvalhojr
Copy link
Owner

That's a good point! My comment about it being less safe was about users doing export SESSION=xyz on the command line and the cookie staying in the shell history. Not a major problem, of course. Having it in the keychain would be neat!

@zneix
Copy link

zneix commented Dec 4, 2022

To extend on what OP requests, I'd suggest fully following XDG specification instead of hardcoding support for ~/.config. While the config directory is usually placed at ~/.config and that's the default location, it can be changed to some other location with XDG_CONFIG_HOME environment variable. For reference, see: https://wiki.archlinux.org/title/XDG_Base_Directory#User_directories

@ModProg
Copy link
Contributor Author

ModProg commented Dec 4, 2022

To extend on what OP requests, I'd suggest fully following XDG specification instead of hardcoding support for ~/.config. While the config directory is usually placed at ~/.config and that's the default location, it can be changed to some other location with XDG_CONFIG_HOME environment variable. For reference, see: https://wiki.archlinux.org/title/XDG_Base_Directory#User_directories

already did so

ModProg added a commit to ModProg/aoc-cli that referenced this issue Dec 4, 2022
ModProg added a commit to ModProg/aoc-cli that referenced this issue Dec 5, 2022
ModProg added a commit to ModProg/aoc-cli that referenced this issue Dec 5, 2022
ModProg added a commit to ModProg/aoc-cli that referenced this issue Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants