Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "init4-bin-base"
description = "Internal utilities for binaries produced by the init4 team"
keywords = ["init4", "bin", "base"]

version = "0.12.4"
version = "0.12.5"
edition = "2021"
rust-version = "1.83"
authors = ["init4", "James Prestwich", "evalir"]
Expand Down
2 changes: 1 addition & 1 deletion src/utils/calc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ impl SlotCalculator {
}

impl FromEnv for SlotCalculator {
type Error = FromEnvErr<ParseIntError>;
type Error = ParseIntError;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is technically a breaking change, however, it is correcting an APi error, so is semver patch


fn inventory() -> Vec<&'static EnvItemInfo> {
vec![
Expand Down
19 changes: 18 additions & 1 deletion src/utils/from_env.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use signet_constants::{
HostConstants, RollupConstants, SignetConstants, SignetEnvironmentConstants,
HostConstants, ParseChainError, RollupConstants, SignetConstants, SignetEnvironmentConstants,
SignetSystemConstants,
};
use std::{convert::Infallible, env::VarError, num::ParseIntError, str::FromStr};
Expand Down Expand Up @@ -670,6 +670,23 @@ impl FromEnvVar for tracing::Level {
}
}

impl FromEnv for SignetSystemConstants {
type Error = ParseChainError;

fn inventory() -> Vec<&'static EnvItemInfo> {
vec![&EnvItemInfo {
var: "CHAIN_NAME",
description:
"The name of the chain. If set, the other environment variables are ignored.",
optional: true,
}]
}

fn from_env() -> Result<Self, FromEnvErr<Self::Error>> {
SignetSystemConstants::from_env_var("CHAIN_NAME")
}
}

#[cfg(test)]
mod test {
use std::{borrow::Cow, time::Duration};
Expand Down
Loading