Skip to content

Commit

Permalink
Merge branch 'main' into tb/docs-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
EverlastingBugstopper authored Mar 30, 2022
2 parents e4b6e4a + 1b395a5 commit 57469de
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ In general, it's best to keep related commands together, and to avoid cognitive

### Guide to adding a new command

Prior to adding a new command to Rover, you should familiarize yourself with Rover's existing [architecture](./ARCHITECTURE.md) and to make sure that you have discussed the design of the new command in a [GitHub issue](#Using-issues) before submitting a pull request.
Prior to adding a new command to Rover, you should familiarize yourself with Rover's existing [architecture](./ARCHITECTURE.md) and to make sure that you have discussed the design of the new command in a [GitHub issue](https://github.com/apollographql/rover/issues/new/choose) before submitting a pull request.

#### Example: `rover graph hello`

Expand Down
19 changes: 17 additions & 2 deletions src/command/config/whoami.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rover_client::operations::config::who_am_i::{self, Actor, ConfigWhoAmIInput}
use serde::Serialize;
use structopt::StructOpt;

use houston::CredentialOrigin;
use houston::{mask_key, CredentialOrigin};

use crate::anyhow;
use crate::command::RoverOutput;
Expand All @@ -19,6 +19,14 @@ pub struct WhoAmI {
#[structopt(long = "profile", default_value = "default")]
#[serde(skip_serializing)]
profile_name: String,

/// Unmask the API key that will be sent to Apollo Studio
///
/// You should think very carefully before using this flag.
///
/// If you are sharing your screen your API key could be compromised
#[structopt(long)]
insecure_unmask_key: bool,
}

impl WhoAmI {
Expand Down Expand Up @@ -72,10 +80,17 @@ impl WhoAmI {

let credential =
config::Profile::get_credential(&self.profile_name, &client_config.config)?;

let maybe_masked_key = if self.insecure_unmask_key {
credential.api_key
} else {
mask_key(&credential.api_key)
};

message.push_str(&format!(
"\n{}: {}",
Green.normal().paint("API Key"),
credential.api_key
&maybe_masked_key
));

eprintln!("{}", message);
Expand Down

0 comments on commit 57469de

Please sign in to comment.