Skip to content

Commit

Permalink
Export InstanceName (#240)
Browse files Browse the repository at this point in the history
Ideally, this should be unified with CLI's instance name option parsing,
but for now just export the binding's version for cases where the
instance name is not specified as an explicit argument.
  • Loading branch information
elprans authored May 16, 2023
1 parent e3a5fe2 commit dc71b40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion edgedb-tokio/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ struct DsnHelper<'a> {
query: HashMap<Cow<'a, str>, Cow<'a, str>>,
}

/// Parsed EdgeDB instance name.
#[derive(Clone, Debug)]
enum InstanceName {
pub enum InstanceName {
Local(String),
Cloud {
org_slug: String,
Expand Down Expand Up @@ -1634,6 +1635,10 @@ impl Config {
}
}

pub fn instance_name(&self) -> Option<&InstanceName> {
self.0.instance_name.as_ref()
}

/// Secret key if set
pub fn secret_key(&self) -> Option<&str> {
self.0.secret_key.as_deref()
Expand Down
2 changes: 1 addition & 1 deletion edgedb-tokio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ mod transaction;

pub use edgedb_derive::{Queryable, GlobalsDelta, ConfigDelta};

pub use builder::{Builder, Config};
pub use builder::{Builder, Config, InstanceName};
pub use credentials::TlsSecurity;
pub use client::Client;
pub use errors::Error;
Expand Down

0 comments on commit dc71b40

Please sign in to comment.