diff --git a/crates/houston/src/profile/mod.rs b/crates/houston/src/profile/mod.rs index 3649bf7afc..a32877e4d3 100644 --- a/crates/houston/src/profile/mod.rs +++ b/crates/houston/src/profile/mod.rs @@ -100,7 +100,7 @@ impl Profile { /// Loads and deserializes configuration from the file system for a /// specific profile. - pub fn load( + fn load( profile_name: &str, config: &Config, opts: LoadOpts, diff --git a/src/cli.rs b/src/cli.rs index 5c9bf85f5b..4e738d4553 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -135,7 +135,7 @@ impl Rover { match &self.command { Command::Config(command) => { - command.run(self.get_rover_config()?, self.get_client_config()?) + command.run(self.get_client_config()?) } Command::Supergraph(command) => command.run(), Command::Docs(command) => command.run(), diff --git a/src/command/config/mod.rs b/src/command/config/mod.rs index d4e43ea47d..5780774d59 100644 --- a/src/command/config/mod.rs +++ b/src/command/config/mod.rs @@ -7,8 +7,6 @@ mod whoami; use serde::Serialize; use structopt::StructOpt; -use houston as config; - use crate::command::RoverStdout; use crate::utils::client::StudioClientConfig; use crate::Result; @@ -40,15 +38,14 @@ pub enum Command { impl Config { pub fn run( &self, - config: config::Config, client_config: StudioClientConfig, ) -> Result { match &self.command { - Command::Auth(command) => command.run(config), - Command::List(command) => command.run(config), - Command::Delete(command) => command.run(config), - Command::Clear(command) => command.run(config), - Command::Whoami(command) => command.run(config, client_config), + Command::Auth(command) => command.run(client_config.config), + Command::List(command) => command.run(client_config.config), + Command::Delete(command) => command.run(client_config.config), + Command::Clear(command) => command.run(client_config.config), + Command::Whoami(command) => command.run(client_config), } } } diff --git a/src/command/config/whoami.rs b/src/command/config/whoami.rs index 98071a58ea..83742d8af3 100644 --- a/src/command/config/whoami.rs +++ b/src/command/config/whoami.rs @@ -24,7 +24,6 @@ pub struct WhoAmI { impl WhoAmI { pub fn run( &self, - config: config::Config, client_config: StudioClientConfig, ) -> Result { let client = client_config.get_client(&self.profile_name)?; @@ -74,12 +73,11 @@ impl WhoAmI { message.push_str(&format!("{}: {}", Green.normal().paint("Origin"), &origin)); - let opts = config::LoadOpts { sensitive: true }; - let profile = config::Profile::load(&self.profile_name, &config, opts)?; + let credential = config::Profile::get_credential(&self.profile_name, &client_config.config)?; message.push_str(&format!( "\n{}: {}", Green.normal().paint("API Key"), - profile + credential.api_key )); eprintln!("{}", message); diff --git a/src/utils/client.rs b/src/utils/client.rs index dc185d43a4..4f010a8ed1 100644 --- a/src/utils/client.rs +++ b/src/utils/client.rs @@ -9,7 +9,7 @@ const STUDIO_PROD_API_ENDPOINT: &str = "https://graphql.api.apollographql.com/ap pub struct StudioClientConfig { uri: String, - config: config::Config, + pub config: config::Config, version: String, }