Skip to content

Commit

Permalink
nit. more logging, copy previous-tc
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusl committed Jun 22, 2023
1 parent c7b5843 commit 72c3ecb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/config/login_config.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::path::PathBuf;

use toml_edit::{Document, Table};
use tracing::info;

use crate::Error;

Expand Down Expand Up @@ -79,6 +80,7 @@ impl LoginConfig {
/// Authorizes a host,
///
pub fn authorize(&self, host: impl AsRef<str>) -> Option<(&str, &str)> {
info!("Checking for login {}", host.as_ref());
self.doc["auth"].as_table().and_then(|t| t.get(host.as_ref()).and_then(|v| v.as_table()).and_then(|t| {
if let (Some(u), Some(p)) = (t["username"].as_str(), t["password"].as_str()) {
Some((u, p))
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ impl Plugin for Login {
debug!("Starting registry login");

// If username/password are set w/ the context, skip getting credentials
if tc.state().find_symbol("REGISTRY_PASSWORD").is_some() && tc.state().find_symbol("REGISTRY_USER").is_some() {
if tc.search().find_symbol("REGISTRY_PASSWORD").is_some() && tc.search().find_symbol("REGISTRY_USER").is_some() {
debug!("Skipping login, password/username is set");
tc.copy_previous();
return Ok(tc);
}

Expand Down

0 comments on commit 72c3ecb

Please sign in to comment.