sui_bridge_indexer/
config.rs

1// Copyright (c) Mysten Labs, Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4use serde::{Deserialize, Serialize};
5use std::env;
6
7/// config as loaded from `config.yaml`.
8#[derive(Debug, Clone, Deserialize, Serialize)]
9pub struct IndexerConfig {
10    pub remote_store_url: String,
11    /// Only provide this if you use a colocated FN
12    pub checkpoints_path: Option<String>,
13
14    pub sui_rpc_url: String,
15    pub eth_rpc_url: String,
16    pub eth_ws_url: String,
17
18    #[serde(default = "default_db_url")]
19    pub db_url: String,
20    pub concurrency: u64,
21    /// Used as the starting checkpoint for backfill tasks when indexer starts with an empty DB.
22    pub sui_bridge_genesis_checkpoint: u64,
23    /// Used as the starting checkpoint for backfill tasks when indexer starts with an empty DB.
24    pub eth_bridge_genesis_block: u64,
25    pub eth_sui_bridge_contract_address: String,
26
27    pub metric_port: u16,
28
29    #[serde(default)]
30    pub eth_only: bool,
31}
32
33impl sui_config::Config for IndexerConfig {}
34
35pub fn default_db_url() -> String {
36    env::var("DB_URL").expect("db_url must be set in config or via the $DB_URL env var")
37}