Skip to content

Commit

Permalink
chore: Update to new zitadel-rust-client Zitadel::new()
Browse files Browse the repository at this point in the history
  • Loading branch information
tlater-famedly committed Jul 24, 2024
1 parent 2c5cd03 commit ee015b0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 5 additions & 8 deletions src/zitadel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use anyhow::{anyhow, Result};
use itertools::Itertools;
use ldap_poller::ldap3::SearchEntry;
use zitadel_rust_client::{
Config as ZitadelConfig, Email, Gender, Idp, ImportHumanUserRequest, Phone, Profile,
Zitadel as ZitadelClient,
Email, Gender, Idp, ImportHumanUserRequest, Phone, Profile, Zitadel as ZitadelClient,
};

use crate::config::{Config, FeatureFlag};
Expand All @@ -20,12 +19,10 @@ pub(crate) struct Zitadel {
impl Zitadel {
/// Construct the Zitadel instance
pub(crate) async fn new(config: &Config) -> Result<Self> {
let zitadel_config =
ZitadelConfig::new(config.clone().famedly.url, config.clone().famedly.key_file);

let client = ZitadelClient::new(&zitadel_config)
.await
.map_err(|message| anyhow!("failed to configure zitadel client: {}", message))?;
let client =
ZitadelClient::new(config.famedly.url.clone(), config.famedly.key_file.clone())
.await
.map_err(|message| anyhow!("failed to configure zitadel client: {}", message))?;

Ok(Self { client, config: config.clone() })
}
Expand Down
8 changes: 2 additions & 6 deletions tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ use ldap3::{Ldap as LdapClient, LdapConnAsync, LdapConnSettings};
use tempfile::TempDir;
use test_log::test;
use tokio::sync::OnceCell;
use zitadel_rust_client::{
error::Error as ZitadelError, error::TonicErrorCode, Config as ZitadelConfig, Type, Zitadel,
};
use zitadel_rust_client::{error::Error as ZitadelError, error::TonicErrorCode, Type, Zitadel};

use ldap_sync::{do_the_thing, Config};

Expand Down Expand Up @@ -224,9 +222,7 @@ impl Ldap {
/// Open a connection to the configured Zitadel backend
async fn open_zitadel_connection() -> Zitadel {
let famedly = config().await.famedly.clone();
let zitadel_config = ZitadelConfig::new(famedly.url, famedly.key_file);

Zitadel::new(&zitadel_config).await.expect("failed to set up Zitadel client")
Zitadel::new(famedly.url, famedly.key_file).await.expect("failed to set up Zitadel client")
}

/// Get the module's test environment config
Expand Down

0 comments on commit ee015b0

Please sign in to comment.