Skip to content

Commit

Permalink
Prepare v0.1.24
Browse files Browse the repository at this point in the history
  • Loading branch information
Caspar Oostendorp committed Mar 1, 2024
1 parent 1549598 commit 655d725
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.23
0.1.24
2 changes: 1 addition & 1 deletion chart/keiko/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.23"
appVersion: "0.1.24"
29 changes: 10 additions & 19 deletions server/src/args.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
use std::fs::File;
use std::path::PathBuf;
use clap::{Args, Parser};
use jsonrpsee_http_client::{HttpClient, HttpClientBuilder};
use url::Url;
use std::str::FromStr;
use keiko_api::server_state;
use std::net::SocketAddr;
use serde_json::Value;

const LOCAL_KATANA: &str = "http://0.0.0.0:5050";
const LOCAL_TORII: &str = "http://0.0.0.0:8080";
const KATANA_GENESIS_PATH: &str = "config/genesis.json";

pub const KEIKO_ASSETS: &str = "static/keiko/assets";
pub const KEIKO_INDEX: &str = "static/keiko/index.html";
pub const KATANA_LOG: &str = "log/katana.log.json";
pub const TORII_LOG: &str = "log/torii.log";
pub const TORII_DB: &str = "torii.sqlite";
pub const CONFIG_MANIFEST: &str = "config/manifest.json";


#[derive(Debug, Clone)]
Expand Down Expand Up @@ -45,14 +41,7 @@ impl From<KeikoArgs> for Config {
impl Config {
pub fn new() -> Self {
let keiko_args = KeikoArgs::parse();
let mut config = Self::from(keiko_args);

// Get the world address from the manifest
let manifest_json: Value = serde_json::from_reader(
File::open(CONFIG_MANIFEST).expect("File should open read only")
).expect("Cannot parse config/manifest.json");

config.set_world_address(manifest_json["world"]["address"].as_str().unwrap().to_string());
let config = Self::from(keiko_args);

config
}
Expand Down Expand Up @@ -165,6 +154,11 @@ pub struct ToriiOptions {

#[derive(Debug, Args, Clone)]
pub struct KatanaOptions {
#[arg(long)]
#[arg(help = "The world address Keiko uses")]
#[arg(env = "WORLD_ADDRESS")]
pub world_address: String,

#[arg(long)]
#[arg(help = "Don't print anything on startup.")]
pub katana_silent: bool,
Expand All @@ -181,6 +175,7 @@ pub struct KatanaOptions {

#[arg(long)]
#[arg(value_name = "PATH")]
#[arg(env = "KATANA_DB_DIR")]
#[arg(help = "Directory path of the database to initialize from.")]
#[arg(long_help = "Directory path of the database to initialize from. The path must either \
be an empty directory or a directory which already contains a previously \
Expand Down Expand Up @@ -225,18 +220,14 @@ pub struct KatanaOptions {


impl Config {
pub fn set_world_address(&mut self, world_address: String) {
self.world_address = world_address;
}

pub fn get_storage_base_dir(&self) -> String {
format!("storage/{}", self.world_address)
format!("storage/{}", self.katana.world_address)
}

pub fn get_torii_args(&self) -> Vec<String> {
let mut args = vec![
"--world".to_string(),
self.world_address.clone(),
self.katana.world_address.clone(),
"--database".to_string(),
format!("{}/{}", self.get_storage_base_dir().clone(), TORII_DB),
];
Expand Down Expand Up @@ -316,7 +307,7 @@ impl Config {
}

args.push("--genesis".to_string());
args.push(KATANA_GENESIS_PATH.to_string());
args.push(format!("{}/config/genesis.json", self.get_storage_base_dir()));

args
}
Expand Down

0 comments on commit 655d725

Please sign in to comment.