forked from kmesh-net/orion
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert.rs
More file actions
17 lines (16 loc) · 798 Bytes
/
convert.rs
File metadata and controls
17 lines (16 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#![allow(clippy::print_stdout)]
use orion_configuration::config::Bootstrap;
use orion_error::{Context, Result};
use std::fs::File;
fn main() -> Result<()> {
let bootstrap =
Bootstrap::deserialize_from_envoy(File::open("bootstrap.yaml").context("failed to open bootstrap.yaml")?)
.context("failed to convert envoy to orion")?;
let yaml = serde_yaml::to_string(&bootstrap).context("failed to serialize orion")?;
std::fs::write("orion.yaml", yaml.as_bytes())?;
let bootstrap: Bootstrap = serde_yaml::from_reader(File::open("orion.yaml").context("failed to open orion.yaml")?)
.context("failed to read yaml from file")?;
let yaml = serde_yaml::to_string(&bootstrap).context("failed to round-trip serialize orion")?;
println!("{yaml}");
Ok(())
}