diff --git a/config/Settings.example.toml b/config/Settings.example.toml index 8e28bff..102809d 100644 --- a/config/Settings.example.toml +++ b/config/Settings.example.toml @@ -1,6 +1,7 @@ log_level = "info" log_format = "pretty" -network = "public-testnet-15" +# The chain name is the Chain ID value without what is after the '.' (e.g 'shielded-expedition.88f17d1d14' -> 'shielded-expedition') +chain_name = "public-testnet-15" [database] host = "localhost" diff --git a/docs/03-indexer.md b/docs/03-indexer.md index 92d3f93..43743aa 100644 --- a/docs/03-indexer.md +++ b/docs/03-indexer.md @@ -11,7 +11,7 @@ Settings.toml # Level and format of logging in the indexer log_level = "info" log_format = "pretty" # optional; either "pretty" or "json" -network = "public-testnet-15" # IMPORANT! Do not use `.` just put the name of the network and don't have the hash (e.g 'shielded-expedition.b40d8e9055' becomes 'shielded-expedition') +chain_name = "public-testnet-15" # IMPORANT! Do not use `.` just put the name of the network and don't have the hash (e.g 'shielded-expedition.b40d8e9055' becomes 'shielded-expedition') # Connection information for the PostgreSQL database [database] diff --git a/docs/04-server.md b/docs/04-server.md index 36ead45..0bd545c 100644 --- a/docs/04-server.md +++ b/docs/04-server.md @@ -9,7 +9,7 @@ Settings.toml ```toml log_level = "info" log_format = "pretty" # optional; either "pretty" or "json" -network = "public-testnet-15" # IMPORANT! Do not use `.` just put the name of the network and don't have the hash (e.g 'shielded-expedition.b40d8e9055' becomes 'shielded-expedition') +chain_name = "public-testnet-15" # IMPORANT! Do not use `.` the chain name is juste the Chain ID without what is after the '.' (e.g 'shielded-expedition.b40d8e9055' becomes 'shielded-expedition') # Connection information for the PostgreSQL database [database] diff --git a/src/bin/indexer.rs b/src/bin/indexer.rs index 22d7486..4618e35 100644 --- a/src/bin/indexer.rs +++ b/src/bin/indexer.rs @@ -51,7 +51,7 @@ async fn main() -> Result<(), Error> { info!("Starting database connection"); - let db = Database::new(cfg.database_config(), cfg.network.as_str()).await?; + let db = Database::new(cfg.database_config(), cfg.chain_name.as_str()).await?; info!("Creating tables"); db.create_tables().await?; diff --git a/src/bin/server.rs b/src/bin/server.rs index 0c94ccc..27515df 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs @@ -10,7 +10,7 @@ async fn main() -> Result<(), Error> { setup_logging(&cfg); - let db = Database::new(cfg.database_config(), cfg.network.as_str()).await?; + let db = Database::new(cfg.database_config(), cfg.chain_name.as_str()).await?; // Start JSON server start_server(db, cfg.server_config()).await?; diff --git a/src/config.rs b/src/config.rs index 3ae4b01..f8166fc 100644 --- a/src/config.rs +++ b/src/config.rs @@ -18,7 +18,7 @@ pub const JAEGER_PORT: u16 = 6831; pub const PROMETHEUS_HOST: &str = "localhost"; pub const PROMETHEUS_PORT: u16 = 9000; -pub const DEFAULT_NETWORK: &str = "public-testnet-15"; +pub const DEFAULT_CHAIN_NAME: &str = "public-testnet-15"; pub const DEFAULT_LOG_FORMAT: &str = "pretty"; @@ -141,8 +141,8 @@ pub struct CliSettings { pub log_level: String, #[clap(long, env, default_value = DEFAULT_LOG_FORMAT)] pub log_format: LogFormat, - #[clap(long, env, default_value = DEFAULT_NETWORK)] - pub network: String, + #[clap(long, env, default_value = DEFAULT_CHAIN_NAME)] + pub chain_name: String, #[clap(long, env, default_value = SERVER_ADDR)] pub server_serve_at: String, #[clap(long, env, default_value_t = SERVER_PORT)] @@ -180,7 +180,7 @@ pub struct Settings { pub log_level: String, #[serde(default)] pub log_format: LogFormat, - pub network: String, + pub chain_name: String, pub database: DatabaseConfig, pub server: ServerConfig, pub indexer: IndexerConfig, @@ -193,7 +193,7 @@ impl Default for Settings { Self { log_level: Default::default(), log_format: Default::default(), - network: DEFAULT_NETWORK.to_string(), + chain_name: DEFAULT_CHAIN_NAME.to_string(), database: Default::default(), server: Default::default(), indexer: Default::default(), @@ -208,7 +208,7 @@ impl From for Settings { Self { log_level: value.log_level, log_format: value.log_format, - network: value.network, + chain_name: value.chain_name, database: DatabaseConfig { host: value.database_host, user: value.database_user, @@ -252,9 +252,9 @@ impl Settings { let settings: Self = config.try_deserialize().map_err(Error::from)?; - // verify if network is correct - if settings.network.contains('.') { - panic!("network cannot contains '.' (example of valid network 'public-testnet-14')") + // verify if chain_name is correct + if settings.chain_name.contains('.') { + panic!("chain_name cannot contains '.' (example of valid chain_name 'public-testnet-14')") } return Ok(settings);