iota_bridge_indexer/
config.rs

1// Copyright (c) Mysten Labs, Inc.
2// Modifications Copyright (c) 2024 IOTA Stiftung
3// SPDX-License-Identifier: Apache-2.0
4
5use std::env;
6
7use serde::{Deserialize, Serialize};
8
9/// config as loaded from `config.yaml`.
10#[derive(Debug, Clone, Deserialize, Serialize)]
11pub struct IndexerConfig {
12    pub remote_store_url: String,
13    pub eth_rpc_url: String,
14    #[serde(default = "default_db_url")]
15    pub db_url: String,
16    pub eth_ws_url: String,
17    pub checkpoints_path: String,
18    pub concurrency: u64,
19    pub bridge_genesis_checkpoint: u64,
20    pub eth_iota_bridge_contract_address: String,
21    pub start_block: u64,
22    pub metric_url: String,
23    pub metric_port: u16,
24    pub iota_rpc_url: Option<String>,
25    pub back_fill_lot_size: u64,
26    pub resume_from_checkpoint: Option<u64>,
27}
28
29impl iota_config::Config for IndexerConfig {}
30
31pub fn default_db_url() -> String {
32    env::var("DB_URL").expect("db_url must be set in config or via the $DB_URL env var")
33}