summaryrefslogtreecommitdiff
path: root/crates/env/src/workspace
diff options
context:
space:
mode:
Diffstat (limited to 'crates/env/src/workspace')
-rw-r--r--crates/env/src/workspace/local/config.rs26
1 files changed, 21 insertions, 5 deletions
diff --git a/crates/env/src/workspace/local/config.rs b/crates/env/src/workspace/local/config.rs
index ddb7dd0..d641880 100644
--- a/crates/env/src/workspace/local/config.rs
+++ b/crates/env/src/workspace/local/config.rs
@@ -4,22 +4,28 @@ use std::net::SocketAddr;
use crate::constants::CLIENT_FILE_WORKSPACE;
use crate::constants::PORT;
+use crate::workspace::vault::MemberId;
#[derive(Serialize, Deserialize, ConfigFile)]
#[cfg_file(path = CLIENT_FILE_WORKSPACE)]
pub struct LocalConfig {
- /// The vault address, representing the upstream address of the local workspace,
+ /// The upstream address, representing the upstream address of the local workspace,
/// to facilitate timely retrieval of new updates from the upstream source.
- vault_addr: SocketAddr,
+ upstream_addr: SocketAddr,
+
+ /// The member ID used by the current local workspace.
+ /// This ID will be used to verify access permissions when connecting to the upstream server.
+ using_account: MemberId,
}
impl Default for LocalConfig {
fn default() -> Self {
Self {
- vault_addr: SocketAddr::V4(std::net::SocketAddrV4::new(
+ upstream_addr: SocketAddr::V4(std::net::SocketAddrV4::new(
std::net::Ipv4Addr::new(127, 0, 0, 1),
PORT,
)),
+ using_account: "unknown".to_string(),
}
}
}
@@ -27,11 +33,21 @@ impl Default for LocalConfig {
impl LocalConfig {
/// Set the vault address.
pub fn set_vault_addr(&mut self, addr: SocketAddr) {
- self.vault_addr = addr;
+ self.upstream_addr = addr;
}
/// Get the vault address.
pub fn vault_addr(&self) -> SocketAddr {
- self.vault_addr
+ self.upstream_addr
+ }
+
+ /// Set the currently used account
+ pub fn set_current_account(&mut self, account: MemberId) {
+ self.using_account = account;
+ }
+
+ /// Get the currently used account
+ pub fn current_account(&self) -> MemberId {
+ self.using_account.clone()
}
}