-
Notifications
You must be signed in to change notification settings - Fork 8
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
Try multiple file paths for netrc file #149
base: main
Are you sure you want to change the base?
Conversation
@@ -477,6 +482,22 @@ fn validate_segment(s: &str) -> Result<(), FhError> { | |||
Ok(()) | |||
} | |||
|
|||
// See if the netrc exists at the /nix/var/determinate/netrc and, if not, try | |||
// to find it via XDG path. | |||
async fn get_netrc_path(xdg: &BaseDirectories) -> Result<PathBuf, FhError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kinda wonder about this... I think we probably need two separate functions: one for when we're getting a path-to-write-to (i.e. the user running fh login
without determinate-nixd running), and one for when we're getting a path-to-read-from.
In the write-to one, it would take into account if determinate-nixd is running and return None
if it is (since it won't write to a file, but will instead tell the daemon) and Some(xdg-path)
if it's not.
In the read-from one, it would return netrcnotfound if the determinate and normal netrc files are not found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the canonical way to determine if dnixd is running?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the dnixd_uds
function is a good starting point, but basically request to http://localhost/info
and see if it responds with 200.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool cool, shouldn't be too bad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cole-h What action do we take if the write-to path is None
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine that case is only reachable when we're using dnixd, so we just wouldn't write a file and tell the daemon to use this token the same way we do it already.
This is meant to support older installs that placed the
netrc
at the relevant XDG path rather than in/nix
.