Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync code with .env in build.rs #4876

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

dynco-nym
Copy link
Contributor

@dynco-nym dynco-nym commented Sep 14, 2024

Keep dotenv file always up to date

index 2be5300bd..e40e54a47 100644
--- a/envs/mainnet.env
+++ b/envs/mainnet.env
@@ -25,4 +25,4 @@ NYXD="https://rpc.nymtech.net"
-NYM_VPN_API="https://nymvpn.net/api/"
+NYM_VPN_API="https://nymvpn.com/api"

... and we already see its use case :)


This change is Reviewable

Copy link

vercel bot commented Sep 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
nym-explorer ⬜️ Ignored (Inspect) Visit Preview Sep 24, 2024 2:52pm
nym-next-explorer ⬜️ Ignored (Inspect) Visit Preview Sep 24, 2024 2:52pm

Copy link
Contributor

@octol octol left a comment

Choose a reason for hiding this comment

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

I think this is a great idea!

Seeing this I realize that the mainnet default use for nym-vpi-api is wrong, it should be nymvpn.com not .net, so that's great that this code caught that :)

Put in some comments that I think it would be good to make it error if the directory is not correct (due e.g the crate being moved or built from somewhere else). For example what happens when you package this crate using cargo package? Another option here is move this code to a unit test that confirms that the file contents match the env file?

use regex::Regex;
use std::{collections::HashMap, fs};

const TARGET_ENV_FILE: &str = "../../envs/mainnet.env";
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder about this, do you think it's possible to make this relative to the repo root directory? Soon I would like to move the root Rust workspace to a subdirectory to avoid the workspace nesting, and this would then break

Also put in a check that we are writing to the directory we think we are. So that it doesn't try to write the file unless the directory path is correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants