Updated upgrade commands to set new default validator (#413)

This commit is contained in:
Jędrzej Stuczyński
2020-11-04 12:53:25 +00:00
committed by GitHub
parent 9d9d530581
commit e4c8a6b72b
9 changed files with 72 additions and 14 deletions
+16 -3
View File
@@ -12,7 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::config::{missing_string_value, Config, DEFAULT_METRICS_SERVER};
use crate::config::{
missing_string_value, Config, DEFAULT_METRICS_SERVER, DEFAULT_VALIDATOR_REST_ENDPOINT,
};
use clap::{App, Arg, ArgMatches};
use config::NymConfig;
use crypto::asymmetric::identity;
@@ -94,16 +96,27 @@ fn pre_090_upgrade(from: &str, config: Config) -> Config {
}
if config.get_metrics_server() != missing_string_value::<String>() {
eprintln!("existing config seems to have specified new metrics-server endpoint which was only introduced in 0.9.0! Can't perform upgrade.");
eprintln!("existing config seems to have specified new metrics-server endpoint which was only introduced in 0.9.0! Can't perform upgrade.");
print_failed_upgrade(&from_version, &to_version);
process::exit(1);
}
if config.get_validator_rest_endpoint() != missing_string_value::<String>() {
eprintln!("existing config seems to have specified new validator rest endpoint which was only introduced in 0.9.0! Can't perform upgrade.");
print_failed_upgrade(&from_version, &to_version);
process::exit(1);
}
let mut upgraded_config = config
.with_custom_version(to_version.to_string().as_ref())
.with_custom_metrics_server(DEFAULT_METRICS_SERVER);
.with_custom_metrics_server(DEFAULT_METRICS_SERVER)
.with_custom_validator(DEFAULT_VALIDATOR_REST_ENDPOINT);
println!("Setting metrics server to {}", DEFAULT_METRICS_SERVER);
println!(
"Setting validator REST endpoint to to {}",
DEFAULT_VALIDATOR_REST_ENDPOINT
);
println!("Generating new identity...");
let identity_keys = identity::KeyPair::new();
+2 -2
View File
@@ -31,7 +31,7 @@ pub(crate) const MISSING_VALUE: &str = "MISSING VALUE";
// 'MIXNODE'
const DEFAULT_LISTENING_PORT: u16 = 1789;
pub(crate) const DEFAULT_VALIDATOR_REST_ENDPOINT: &str = "https://directory.nymtech.net";
pub(crate) const DEFAULT_VALIDATOR_REST_ENDPOINT: &str = "https://validator.nymtech.net";
pub(crate) const DEFAULT_METRICS_SERVER: &str = "https://metrics.nymtech.net";
// 'DEBUG'
@@ -396,7 +396,7 @@ pub struct MixNode {
public_sphinx_key_file: PathBuf,
/// Validator server to which the node will be reporting their presence data.
#[serde(alias = "presence_directory_server")]
#[serde(default = "missing_string_value")]
validator_rest_url: String,
/// Metrics server to which the node will be reporting their metrics data.