From d45990daf84e18d7ee3c3f17aa4fb5933d8ad64b Mon Sep 17 00:00:00 2001 From: pauldelucia Date: Wed, 20 Nov 2024 13:46:19 +0700 Subject: [PATCH 1/4] fix: remove duplicate testnet nodes in env and remove unused env in exe dir --- .env.example | 2 +- .github/workflows/release.yml | 1 - .gitignore | 2 -- src/app_dir.rs | 7 ++----- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index 1a670ee2..43284649 100644 --- a/.env.example +++ b/.env.example @@ -10,7 +10,7 @@ MAINNET_WALLET_PRIVATE_KEY= # Testnet configuration TESTNET_SHOW_IN_UI=true -TESTNET_DAPI_ADDRESSES=https://34.214.48.68:1443,https://35.166.18.166:1443,https://52.12.176.90:1443,https://44.233.44.95:1443,https://52.12.176.90:1443,https://44.233.44.95:1443,https://52.34.144.50:1443,https://44.240.98.102:1443,https://54.201.32.131:1443,https://52.10.229.11:1443,https://52.13.132.146:1443,https://44.228.242.181:1443,https://35.82.197.197:1443,https://52.40.219.41:1443,https://44.239.39.153:1443,https://54.149.33.167:1443,https://35.164.23.245:1443,https://52.33.28.47:1443,https://52.43.86.231:1443,https://52.43.13.92:1443,https://35.163.144.230:1443,https://52.89.154.48:1443,https://52.24.124.162:1443,https://35.85.21.179:1443,https://54.187.14.232:1443,https://54.68.235.201:1443,https://52.13.250.182:1443,https://35.82.49.196:1443,https://44.232.196.6:1443,https://54.189.164.39:1443,https://54.213.204.85:1443 +TESTNET_DAPI_ADDRESSES=https://34.214.48.68:1443,https://35.166.18.166:1443,https://52.12.176.90:1443,https://44.233.44.95:1443,https://52.34.144.50:1443,https://44.240.98.102:1443,https://54.201.32.131:1443,https://52.10.229.11:1443,https://52.13.132.146:1443,https://44.228.242.181:1443,https://35.82.197.197:1443,https://52.40.219.41:1443,https://44.239.39.153:1443,https://54.149.33.167:1443,https://35.164.23.245:1443,https://52.33.28.47:1443,https://52.43.86.231:1443,https://52.43.13.92:1443,https://35.163.144.230:1443,https://52.89.154.48:1443,https://52.24.124.162:1443,https://35.85.21.179:1443,https://54.187.14.232:1443,https://54.68.235.201:1443,https://52.13.250.182:1443,https://35.82.49.196:1443,https://44.232.196.6:1443,https://54.189.164.39:1443,https://54.213.204.85:1443 TESTNET_CORE_HOST=127.0.0.1 TESTNET_CORE_RPC_PORT=19998 TESTNET_CORE_RPC_USER=dashrpc diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 710fd8e5..d0512baf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,7 +68,6 @@ jobs: - name: Setup prerequisites run: | mkdir -p dash-evo-tool/ - cp .env.example dash-evo-tool/.env cp -r dash_core_configs/ dash-evo-tool/dash_core_configs - name: Install Rust toolchain diff --git a/.gitignore b/.gitignore index d2db760d..99cebd92 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,6 @@ debug/ target/ # Dot env file -.env -.env.backups .testnet_nodes.yml # Visual Studo Code configuration diff --git a/src/app_dir.rs b/src/app_dir.rs index 69ff100d..4b7bfa6c 100644 --- a/src/app_dir.rs +++ b/src/app_dir.rs @@ -45,16 +45,13 @@ pub fn copy_env_file_if_not_exists() { let app_data_dir = app_user_data_dir_path().expect("Failed to determine application data directory"); let env_file_in_app_dir = app_data_dir.join(".env".to_string()); - if env_file_in_app_dir.exists() && env_file_in_app_dir.is_file() { - } else { + if !env_file_in_app_dir.exists() || !env_file_in_app_dir.is_file() { let env_example_file_in_exe_dir = PathBuf::from(".env.example"); if env_example_file_in_exe_dir.exists() && env_example_file_in_exe_dir.is_file() { fs::copy(&env_example_file_in_exe_dir, env_file_in_app_dir) .expect("Failed to copy main net env file"); } else { - let env_file_in_exe_dir = PathBuf::from(".env"); - fs::copy(&env_file_in_exe_dir, env_file_in_app_dir) - .expect("Failed to copy main net env file"); + panic!("Failed to create environment variables: failed to find .env.example file in the executable directory"); } } } From 8d452aa1d96c9a88755bef11a76550685ab3a904 Mon Sep 17 00:00:00 2001 From: pauldelucia Date: Wed, 20 Nov 2024 13:53:41 +0700 Subject: [PATCH 2/4] fix error message --- src/app_dir.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app_dir.rs b/src/app_dir.rs index 4b7bfa6c..67e6867a 100644 --- a/src/app_dir.rs +++ b/src/app_dir.rs @@ -51,7 +51,7 @@ pub fn copy_env_file_if_not_exists() { fs::copy(&env_example_file_in_exe_dir, env_file_in_app_dir) .expect("Failed to copy main net env file"); } else { - panic!("Failed to create environment variables: failed to find .env.example file in the executable directory"); + panic!("Failed to find or create environment variables"); } } } From f7d6bb21e796742b9d8d164c40a9990b677a2807 Mon Sep 17 00:00:00 2001 From: pauldelucia Date: Wed, 20 Nov 2024 16:19:36 +0700 Subject: [PATCH 3/4] fix --- .github/workflows/release.yml | 1 + src/app_dir.rs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d0512baf..710fd8e5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,6 +68,7 @@ jobs: - name: Setup prerequisites run: | mkdir -p dash-evo-tool/ + cp .env.example dash-evo-tool/.env cp -r dash_core_configs/ dash-evo-tool/dash_core_configs - name: Install Rust toolchain diff --git a/src/app_dir.rs b/src/app_dir.rs index 67e6867a..1ddf2493 100644 --- a/src/app_dir.rs +++ b/src/app_dir.rs @@ -49,9 +49,10 @@ pub fn copy_env_file_if_not_exists() { let env_example_file_in_exe_dir = PathBuf::from(".env.example"); if env_example_file_in_exe_dir.exists() && env_example_file_in_exe_dir.is_file() { fs::copy(&env_example_file_in_exe_dir, env_file_in_app_dir) - .expect("Failed to copy main net env file"); + .expect("Failed to copy env file"); } else { - panic!("Failed to find or create environment variables"); + let env_file_in_exe_dir = PathBuf::from(".env"); + fs::copy(&env_file_in_exe_dir, env_file_in_app_dir).expect("Failed to copy env file"); } } } From c9cc4e7519b38f3eb4160bd636df3e135d899584 Mon Sep 17 00:00:00 2001 From: Paul DeLucia <69597248+pauldelucia@users.noreply.github.com> Date: Wed, 20 Nov 2024 19:59:08 +0700 Subject: [PATCH 4/4] undo gitignore change --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 99cebd92..d2db760d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ debug/ target/ # Dot env file +.env +.env.backups .testnet_nodes.yml # Visual Studo Code configuration