From 0a74ddaac53ecc39db581ce0b96da92290d27213 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Mon, 26 Jun 2023 10:02:40 +0800 Subject: [PATCH] Make the CLI respect the --token flag --- lib/registry/src/wasmer_env.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/registry/src/wasmer_env.rs b/lib/registry/src/wasmer_env.rs index cb3011eb453..9935f06abaf 100644 --- a/lib/registry/src/wasmer_env.rs +++ b/lib/registry/src/wasmer_env.rs @@ -81,6 +81,12 @@ impl WasmerEnv { /// The API token for the active registry. pub fn token(&self) -> Option { + if let Some(token) = &self.token { + return Some(token.clone()); + } + + // Fall back to the config file + let config = self.config().ok()?; let login = config.registry.current_login()?; Some(login.token.clone())