Skip to content

Commit

Permalink
Put timestamp config for tests into debug namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyagr committed Jan 4, 2023
1 parent 30d9897 commit b293d72
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn get_rng_seed_config(config: &config::Config) -> Option<u64> {

impl UserSettings {
pub fn from_config(config: config::Config) -> Self {
let timestamp = get_timestamp_config(&config, "user.timestamp");
let timestamp = get_timestamp_config(&config, "debug.commit-timestamp");
let rng_seed = get_rng_seed_config(&config);
UserSettings {
config,
Expand All @@ -75,7 +75,7 @@ impl UserSettings {
if new_rng_seed != get_rng_seed_config(&self.config) {
self.rng.reset(new_rng_seed);
}
self.timestamp = get_timestamp_config(&new_config, "user.timestamp");
self.timestamp = get_timestamp_config(&new_config, "debug.commit-timestamp");
self.config = new_config;
Ok(())
}
Expand Down Expand Up @@ -117,7 +117,7 @@ impl UserSettings {
}

pub fn operation_timestamp(&self) -> Option<Timestamp> {
get_timestamp_config(&self.config, "operation.timestamp")
get_timestamp_config(&self.config, "debug.operation-timestamp")
}

pub fn operation_hostname(&self) -> String {
Expand Down
8 changes: 6 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,19 @@ fn env_overrides() -> config::Config {
builder = builder.set_override("user.email", value).unwrap();
}
if let Ok(value) = env::var("JJ_TIMESTAMP") {
builder = builder.set_override("user.timestamp", value).unwrap();
builder = builder
.set_override("debug.commit-timestamp", value)
.unwrap();
}
if let Ok(value) = env::var("JJ_RANDOMNESS_SEED") {
builder = builder
.set_override("debug.randomness-seed", value)
.unwrap();
}
if let Ok(value) = env::var("JJ_OP_TIMESTAMP") {
builder = builder.set_override("operation.timestamp", value).unwrap();
builder = builder
.set_override("debug.operation-timestamp", value)
.unwrap();
}
if let Ok(value) = env::var("JJ_OP_HOSTNAME") {
builder = builder.set_override("operation.hostname", value).unwrap();
Expand Down

0 comments on commit b293d72

Please sign in to comment.