Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #236 from w3f/config
Browse files Browse the repository at this point in the history
align single instance and multi instances config
  • Loading branch information
ironoa authored Feb 20, 2024
2 parents a34b173 + 16de194 commit f1e80b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions charts/polkadot-registrar-challenger/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
description: Polkadot Challenger
name: polkadot-registrar-challenger
version: v0.6.0
appVersion: v0.6.0
version: v0.6.1
appVersion: v0.6.1
apiVersion: v2
18 changes: 9 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ impl LogLevel {
#[derive(Debug, Deserialize)]
#[serde(rename_all = "snake_case", tag = "role", content = "config")]
enum InstanceType {
AdapterListener(AdapterConfig),
SessionNotifier(NotifierConfig),
SingleInstance(SingleInstanceConfig),
AdapterListener(AdapterNotifierConfig),
SessionNotifier(AdapterNotifierConfig),
SingleInstance(AdapterNotifierConfig),
}

#[derive(Debug, Deserialize)]
#[serde(rename_all = "snake_case")]
struct SingleInstanceConfig {
pub adapter: AdapterConfig,
pub notifier: NotifierConfig,
struct AdapterNotifierConfig {
pub adapter: Option<AdapterConfig>,
pub notifier: Option<NotifierConfig>,
}

#[derive(Debug, Deserialize, Clone)]
Expand Down Expand Up @@ -194,15 +194,15 @@ pub async fn run() -> Result<()> {
match instance {
InstanceType::AdapterListener(config) => {
info!("Starting adapter listener instance");
config_adapter_listener(db, config).await?;
config_adapter_listener(db, config.adapter.unwrap()).await?;
}
InstanceType::SessionNotifier(config) => {
info!("Starting session notifier instance");
config_session_notifier(db, config).await?;
config_session_notifier(db, config.notifier.unwrap()).await?;
}
InstanceType::SingleInstance(config) => {
info!("Starting adapter listener and session notifier instances");
let (adapter_config, notifier_config) = (config.adapter, config.notifier);
let (adapter_config, notifier_config) = (config.adapter.unwrap(), config.notifier.unwrap());

config_adapter_listener(db.clone(), adapter_config).await?;
config_session_notifier(db, notifier_config).await?;
Expand Down

0 comments on commit f1e80b3

Please sign in to comment.