From d64748b810bf64638a5eb71eac054d91dae0c0f1 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 21 May 2025 12:32:41 +0100 Subject: feat: add support for default relay overrides via git config so they can be overwritten locally and globally --- src/bin/ngit/sub_commands/login.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/bin/ngit/sub_commands/login.rs') diff --git a/src/bin/ngit/sub_commands/login.rs b/src/bin/ngit/sub_commands/login.rs index e76a089..ed2414a 100644 --- a/src/bin/ngit/sub_commands/login.rs +++ b/src/bin/ngit/sub_commands/login.rs @@ -2,6 +2,7 @@ use anyhow::{Context, Result}; use clap; use ngit::{ cli_interactor::{Interactor, InteractorPrompt, PromptChoiceParms}, + client::Params, git::{get_git_config_item, remove_git_config_item}, login::{SignerInfoSource, existing::load_existing_login}, }; @@ -25,15 +26,17 @@ pub struct SubCommandArgs { } pub async fn launch(args: &Cli, command_args: &SubCommandArgs) -> Result<()> { + let git_repo_result = Repo::discover().context("failed to find a git repository"); + let git_repo = { git_repo_result.ok() }; + let client = if command_args.offline { None } else { - Some(Client::default()) + Some(Client::new(Params::with_git_config_relay_defaults( + &git_repo.as_ref(), + ))) }; - let git_repo_result = Repo::discover().context("failed to find a git repository"); - let git_repo = { git_repo_result.ok() }; - let (logged_out, log_in_locally_only) = logout(git_repo.as_ref(), command_args.local).await?; if logged_out || log_in_locally_only { fresh_login_or_signup( -- cgit v1.2.3