Skip to content

Commit

Permalink
Merge pull request #4904 from systeminit/fnichol/sdf-spicedb-config
Browse files Browse the repository at this point in the history
chore(sdf): rename spice_config field to spicedb for config
  • Loading branch information
fnichol authored Nov 1, 2024
2 parents 772e8e2 + 4f9ef74 commit 654623e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@
reindeer
shellcheck
shfmt
spicedb-zed
tilt
typos
yapf
Expand Down
16 changes: 8 additions & 8 deletions lib/sdf-server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ pub struct Config {
layer_db_config: LayerDbConfig,

#[builder(default)]
spicedb_config: SpiceDbConfig,
spicedb: SpiceDbConfig,

pkgs_path: CanonicalFile,

Expand Down Expand Up @@ -251,8 +251,8 @@ impl Config {

/// Gets a referece to the config's spicedb config
#[must_use]
pub fn spicedb_config(&self) -> &SpiceDbConfig {
&self.spicedb_config
pub fn spicedb(&self) -> &SpiceDbConfig {
&self.spicedb
}
}

Expand Down Expand Up @@ -303,7 +303,7 @@ pub struct ConfigFile {
#[serde(default)]
create_workspace_allowlist: Vec<WorkspacePermissions>,
#[serde(default)]
spicedb_config: SpiceDbConfig,
spicedb: SpiceDbConfig,
}

impl Default for ConfigFile {
Expand All @@ -326,7 +326,7 @@ impl Default for ConfigFile {
boot_feature_flags: Default::default(),
create_workspace_permissions: Default::default(),
create_workspace_allowlist: Default::default(),
spicedb_config: Default::default(),
spicedb: Default::default(),
}
}
}
Expand Down Expand Up @@ -360,7 +360,7 @@ impl TryFrom<ConfigFile> for Config {
boot_feature_flags: value.boot_feature_flags.into_iter().collect::<HashSet<_>>(),
create_workspace_permissions: value.create_workspace_permissions,
create_workspace_allowlist: value.create_workspace_allowlist,
spicedb_config: value.spicedb_config,
spicedb: value.spicedb,
})
}
}
Expand Down Expand Up @@ -496,7 +496,7 @@ fn buck2_development(config: &mut ConfigFile) -> Result<()> {
Some(postgres_cert.clone().try_into()?);
config.pkgs_path = pkgs_path;
config.layer_db_config.pg_pool_config.dbname = "si_layer_db".to_string();
config.spicedb_config.enabled = true;
config.spicedb.enabled = true;

Ok(())
}
Expand Down Expand Up @@ -556,7 +556,7 @@ fn cargo_development(dir: String, config: &mut ConfigFile) -> Result<()> {
Some(postgres_cert.clone().try_into()?);
config.layer_db_config.pg_pool_config.dbname = "si_layer_db".to_string();
config.pkgs_path = pkgs_path;
config.spicedb_config.enabled = true;
config.spicedb.enabled = true;

Ok(())
}
4 changes: 2 additions & 2 deletions lib/sdf-server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ impl Server {
let application_runtime_mode = Arc::new(RwLock::new(ApplicationRuntimeMode::Running));

let mut spicedb_client = None;
if config.spicedb_config().enabled {
spicedb_client = Some(SpiceDbClient::new(config.spicedb_config()).await?);
if config.spicedb().enabled {
spicedb_client = Some(SpiceDbClient::new(config.spicedb()).await?);
}

prepare_maintenance_mode_watcher(application_runtime_mode.clone(), token.clone())?;
Expand Down

0 comments on commit 654623e

Please sign in to comment.