Skip to content

Commit

Permalink
Persist config files for ord env command (#3715)
Browse files Browse the repository at this point in the history
  • Loading branch information
twosatsmaxi committed May 2, 2024
1 parent f75a87e commit a8be5b0
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions src/subcommand/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,23 @@ impl Env {

fs::create_dir_all(&absolute)?;

fs::write(
absolute.join("bitcoin.conf"),
format!(
"datacarriersize=1000000
regtest=1
let bitcoin_conf = absolute.join("bitcoin.conf");

if !bitcoin_conf.try_exists()? {
fs::write(
bitcoin_conf,
format!(
"datacarriersize=1000000
regtest=1
datadir={absolute_str}
listen=0
txindex=1
[regtest]
rpcport={bitcoind_port}
",
),
)?;
),
)?;
}

fs::write(absolute.join("inscription.txt"), "FOO")?;

Expand All @@ -98,7 +102,11 @@ rpcport={bitcoind_port}
})
.unwrap();

fs::write(absolute.join("batch.yaml"), yaml)?;
let batch_yaml = absolute.join("batch.yaml");

if !batch_yaml.try_exists()? {
fs::write(absolute.join("batch.yaml"), yaml)?;
}

let _bitcoind = KillOnDrop(
Command::new("bitcoind")
Expand All @@ -120,10 +128,12 @@ rpcport={bitcoind_port}

let config = absolute.join("ord.yaml");

fs::write(
config,
serde_yaml::to_string(&Settings::for_env(&absolute, &rpc_url, &server_url))?,
)?;
if !config.try_exists()? {
fs::write(
config,
serde_yaml::to_string(&Settings::for_env(&absolute, &rpc_url, &server_url))?,
)?;
}

let ord = std::env::current_exe()?;

Expand Down

0 comments on commit a8be5b0

Please sign in to comment.