Skip to content

Commit

Permalink
Show world explore url when starting Torii (#1565)
Browse files Browse the repository at this point in the history
* Show world explore url

* Url encode torii endpoint

* Replace 0.0.0.0 with localhost

* Capitalize "World Explorer"
  • Loading branch information
JunichiSugiura authored Feb 22, 2024
1 parent 7984fb8 commit f521686
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions bin/torii/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use torii_core::types::Model;
use torii_server::proxy::Proxy;
use tracing::info;
use tracing_subscriber::{fmt, EnvFilter};
use url::Url;
use url::{form_urlencoded, Url};

/// Dojo World Indexer
#[derive(Parser, Debug)]
Expand Down Expand Up @@ -196,8 +196,14 @@ async fn main() -> anyhow::Result<()> {
)
.expect("Failed to start libp2p relay server");

info!(target: "torii::cli", "Starting torii endpoint: {}", format!("http://{}", args.addr));
info!(target: "torii::cli", "Serving Graphql playground: {}\n", format!("http://{}/graphql", args.addr));
let endpoint = format!("http://{}", args.addr);
let gql_endpoint = format!("{}/graphql", endpoint);
let encoded: String =
form_urlencoded::byte_serialize(gql_endpoint.replace("0.0.0.0", "localhost").as_bytes())
.collect();
info!(target: "torii::cli", "Starting torii endpoint: {}", endpoint);
info!(target: "torii::cli", "Serving Graphql playground: {}", gql_endpoint);
info!(target: "torii::cli", "World Explorer is available on: {}\n", format!("https://worlds.dev/torii?url={}", encoded));

if let Some(listen_addr) = args.metrics {
let prometheus_handle = prometheus_exporter::install_recorder("torii")?;
Expand Down

0 comments on commit f521686

Please sign in to comment.