message: refactor: just put get_global_config() right into new()
diff: @@ -17,23 +17,6 @@ pub enum GlobalUser {
  impl GlobalUser {
  pub fn new() -> Result<Self, failure::Error> {
  - get_global_config()
  - }
  -}
  -
  -impl From<GlobalUser> for Credentials {
  - fn from(user: GlobalUser) -> Credentials {
  - match user {
  - GlobalUser::TokenAuth { api_token } => Credentials::UserAuthToken { token: api_token },
  - GlobalUser::GlobalKeyAuth { email, api_key } => Credentials::UserAuthKey {
  - key: api_key,
  - email,
  - },
  - }
  - }
  -}
  -
  -fn get_global_config() -> Result<GlobalUser, failure::Error> {
  let mut s = Config::new();
  let config_path = get_global_config_dir()
  @@ -70,6 +53,19 @@ fn get_global_config() -> Result<GlobalUser, failure::Error> {
  }
  }
  }
  +}
  +
  +impl From<GlobalUser> for Credentials {
  + fn from(user: GlobalUser) -> Credentials {
  + match user {
  + GlobalUser::TokenAuth { api_token } => Credentials::UserAuthToken { token: api_token },
  + GlobalUser::GlobalKeyAuth { email, api_key } => Credentials::UserAuthKey {
  + key: api_key,
  + email,
  + },
  + }
  + }
  +}
  pub fn get_global_config_dir() -> Result<PathBuf, failure::Error> {
  let home_dir = if let Ok(value) = env::var("WRANGLER_HOME") {
  @@ -101,7 +97,7 @@ mod tests {
  env::set_var("CF_EMAIL", "test@cloudflare.com");
  env::set_var("CF_API_KEY", "bar");
  - let user = get_global_config().unwrap();
  + let user = GlobalUser::new().unwrap();
  assert_eq!(
  user,
  GlobalUser::TokenAuth {
  