Skip to content

Commit b7e1952

Browse files
authored
Update SOROBAN env vars to be STELLAR instead. (#2339)
1 parent 4aaca17 commit b7e1952

File tree

8 files changed

+20
-19
lines changed

8 files changed

+20
-19
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ endif
1414
REPOSITORY_BRANCH := "$(shell git rev-parse --abbrev-ref HEAD)"
1515
BUILD_TIMESTAMP ?= $(shell date '+%Y-%m-%dT%H:%M:%S')
1616

17-
SOROBAN_PORT?=8000
17+
STELLAR_PORT?=8000
1818

1919
# The following works around incompatibility between the rust and the go linkers -
2020
# the rust would generate an object file with min-version of 13.0 where-as the go
@@ -52,7 +52,7 @@ test: build-test
5252
cargo test --workspace --exclude soroban-test --features additional-libs
5353
cargo test -p soroban-test -- --skip integration::
5454

55-
# expects a quickstart container running with the rpc exposed at localhost:SOROBAN_PORT
55+
# expects a quickstart container running with the rpc exposed at localhost:STELLAR_PORT
5656
rpc-test:
5757
cargo test --features it --test it -- integration --test-threads=4
5858

cmd/crates/soroban-test/src/lib.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,10 @@ impl TestEnv {
131131
}
132132

133133
pub fn new() -> TestEnv {
134-
if let Ok(rpc_url) = std::env::var("SOROBAN_RPC_URL") {
135-
return Self::with_rpc_url(&rpc_url);
136-
}
137134
if let Ok(rpc_url) = std::env::var("STELLAR_RPC_URL") {
138135
return Self::with_rpc_url(&rpc_url);
139136
}
140-
let host_port = std::env::var("SOROBAN_PORT")
137+
let host_port = std::env::var("STELLAR_PORT")
141138
.as_deref()
142139
.ok()
143140
.and_then(|n| n.parse().ok())
@@ -159,9 +156,9 @@ impl TestEnv {
159156
let mut cmd: Command = self.bin();
160157

161158
cmd.arg(subcommand)
162-
.env("SOROBAN_ACCOUNT", TEST_ACCOUNT)
163-
.env("SOROBAN_RPC_URL", &self.network.rpc_url)
164-
.env("SOROBAN_NETWORK_PASSPHRASE", LOCAL_NETWORK_PASSPHRASE)
159+
.env("STELLAR_ACCOUNT", TEST_ACCOUNT)
160+
.env("STELLAR_RPC_URL", &self.network.rpc_url)
161+
.env("STELLAR_NETWORK_PASSPHRASE", LOCAL_NETWORK_PASSPHRASE)
165162
.env("XDG_CONFIG_HOME", self.dir().join("config").as_os_str())
166163
.env("XDG_DATA_HOME", self.data_dir().as_os_str())
167164
.current_dir(self.dir());

cmd/crates/soroban-test/tests/it/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ fn use_env() {
200200
sandbox
201201
.new_assert_cmd("keys")
202202
.env(
203-
"SOROBAN_SECRET_KEY",
203+
"STELLAR_SECRET_KEY",
204204
"SDIY6AQQ75WMD4W46EYB7O6UYMHOCGQHLAQGQTKHDX4J2DYQCHVCQYFD",
205205
)
206206
.arg("add")
@@ -225,7 +225,7 @@ fn set_default_identity() {
225225
sandbox
226226
.new_assert_cmd("keys")
227227
.env(
228-
"SOROBAN_SECRET_KEY",
228+
"STELLAR_SECRET_KEY",
229229
"SC4ZPYELVR7S7EE7KZDZN3ETFTNQHHLTUL34NUAAWZG5OK2RGJ4V2U3Z",
230230
)
231231
.arg("add")
@@ -245,7 +245,7 @@ fn set_default_identity() {
245245

246246
sandbox
247247
.new_assert_cmd("env")
248-
.env_remove("SOROBAN_ACCOUNT")
248+
.env_remove("STELLAR_ACCOUNT")
249249
.assert()
250250
.stdout(predicate::str::contains("STELLAR_ACCOUNT=alice"))
251251
.success();

cmd/crates/soroban-test/tests/it/integration/cookbook.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ fn run_command(
135135
let mut assert = sandbox
136136
.new_assert_cmd(&cmd)
137137
// Cookbook tests are responsible for setting a source account.
138-
.env_remove("SOROBAN_ACCOUNT")
138+
.env_remove("STELLAR_ACCOUNT")
139139
.args(&modified_args)
140140
.assert();
141141
eprintln!("{}", assert.stderr_as_str());

cmd/crates/soroban-test/tests/it/integration/dotenv.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use super::util::deploy_hello;
44

55
fn write_env_file(e: &TestEnv, contents: &str) {
66
let env_file = e.dir().join(".env");
7-
let contents = format!("SOROBAN_CONTRACT_ID={contents}");
7+
let contents = format!("STELLAR_CONTRACT_ID={contents}");
88
std::fs::write(&env_file, &contents).unwrap();
99
assert_eq!(contents, std::fs::read_to_string(env_file).unwrap());
1010
}
@@ -33,7 +33,7 @@ async fn current_env_not_overwritten() {
3333
write_env_file(&e, &deploy_hello(&e).await);
3434
e.new_assert_cmd("contract")
3535
.env(
36-
"SOROBAN_CONTRACT_ID",
36+
"STELLAR_CONTRACT_ID",
3737
"CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4",
3838
)
3939
.arg("invoke")
@@ -54,7 +54,7 @@ async fn cli_args_have_priority() {
5454
write_env_file(e, &id);
5555
e.new_assert_cmd("contract")
5656
.env(
57-
"SOROBAN_CONTRACT_ID",
57+
"STELLAR_CONTRACT_ID",
5858
"CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4",
5959
)
6060
.arg("invoke")

cmd/soroban-cli/src/cli.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ pub async fn main() {
2020
// Map SOROBAN_ env vars to STELLAR_ env vars for backwards compatibility
2121
// with the soroban-cli prior to when the stellar-cli was released.
2222
//
23-
let vars = env_vars::unprefixed();
23+
let mut vars = env_vars::unprefixed();
24+
25+
// Manually add SECRET_KEY so it doesn't leak on `stellar env`.
26+
vars.push("SECRET_KEY");
27+
2428
for var in vars {
2529
let soroban_key = format!("SOROBAN_{var}");
2630
let stellar_key = format!("STELLAR_{var}");

cmd/soroban-cli/src/commands/keys/add.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl Cmd {
8282
}
8383

8484
fn read_secret(&self, print: &Print) -> Result<Secret, Error> {
85-
if let Ok(secret_key) = std::env::var("SOROBAN_SECRET_KEY") {
85+
if let Ok(secret_key) = std::env::var("STELLAR_SECRET_KEY") {
8686
Ok(Secret::SecretKey { secret_key })
8787
} else if self.secrets.secure_store {
8888
let prompt = "Type a 12/24 word seed phrase:";

cmd/soroban-cli/src/config/locator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub enum Error {
3535
HomeDirNotFound,
3636
#[error("Failed read current directory")]
3737
CurrentDirNotFound,
38-
#[error("Failed read current directory and no SOROBAN_CONFIG_HOME is set")]
38+
#[error("Failed read current directory and no STELLAR_CONFIG_HOME is set")]
3939
NoConfigEnvVar,
4040
#[error("Failed to create directory: {path:?}")]
4141
DirCreationFailed { path: PathBuf },

0 commit comments

Comments
 (0)