Skip to main content

write_home_config

Function write_home_config 

Source
pub(crate) fn write_home_config(
    api: &str,
    channel: &str,
    key_file: &str,
    invite: &str,
    grants: &[&str],
) -> Option<String>
Expand description

Records the node, channel and key in ~/.choir/config, and the invite redeemed with the repositories it named.

The fallback the .choir/config walk reaches when no directory above the working one names a node — see configured. Existing keys are preserved rather than the file being rewritten, because choir init writes this same file when it is run from $HOME.

The invite is its id and never its secret: enough to tell the same link run again from a second invite, and nothing anybody can redeem. The repositories are what a run again clones when a copy is missing.

None when it could not be written, which is reported rather than fatal for the same reason configure_git_credential’s failure is.