Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hyperdrive/src/http/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ async fn login_handler(
let info = LoginInfo {
password_hash: "secret".to_string(),
subdomain: info.subdomain,
custom_cache_sources: None,
custom_base_l2_access_providers: None,
};

println!("login_handler: got info {info:?}\r");
Expand Down
54 changes: 31 additions & 23 deletions hyperdrive/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ use std::collections::HashMap;
use std::env;
use std::path::Path;
use std::sync::Arc;
use tokio::sync::{mpsc, oneshot};
use tokio::sync::mpsc;

#[cfg(not(feature = "simulation-mode"))]
use tokio::sync::oneshot;

mod eth;
mod eth_config_utils;
Expand Down Expand Up @@ -319,6 +322,7 @@ async fn main() {

is_eth_provider_config_updated = false;

#[cfg(not(feature = "simulation-mode"))]
if !base_l2_access_source_vector.is_empty() {
// Process in reverse order so the first entry in the vector becomes highest priority
for (_reverse_index, provider_str) in
Expand Down Expand Up @@ -485,33 +489,37 @@ async fn main() {
// Create the cache_sources file with test content
let data_file_path = initfiles_dir.join("cache_sources");

// Write cache_source_vector to cache_sources as JSON
let cache_json = serde_json::to_string_pretty(&cache_source_vector)
.expect("Failed to serialize cache_source_vector to JSON");
let cache_json_clone = cache_json.clone();

if let Err(e) = tokio::fs::write(&data_file_path, cache_json).await {
eprintln!("Warning: Failed to write cache data to file: {}", e);
}
#[cfg(not(feature = "simulation-mode"))]
{
// Write cache_source_vector to cache_sources as JSON
let cache_json = serde_json::to_string_pretty(&cache_source_vector)
.expect("Failed to serialize cache_source_vector to JSON");
let cache_json_clone = cache_json.clone();

// Create the second directory structure for hns-indexer:sys
let hns_indexer_dir = vfs_dir.join("hns-indexer:sys");
let hns_initfiles_dir = hns_indexer_dir.join("initfiles");
if let Err(e) = tokio::fs::write(&data_file_path, cache_json).await {
eprintln!("Warning: Failed to write cache data to file: {}", e);
}

// Create all directories at once for the second location
if let Err(e) = tokio::fs::create_dir_all(&hns_initfiles_dir).await {
eprintln!(
"Failed to create directory structure {}: {}",
hns_initfiles_dir.display(),
e
);
}
// Create the second directory structure for hns-indexer:sys
let hns_indexer_dir = vfs_dir.join("hns-indexer:sys");
let hns_initfiles_dir = hns_indexer_dir.join("initfiles");

// Create the cache_sources file in the second location
let hns_data_file_path = hns_initfiles_dir.join("cache_sources");
// Create all directories at once for the second location
if let Err(e) = tokio::fs::create_dir_all(&hns_initfiles_dir).await {
eprintln!(
"Failed to create directory structure {}: {}",
hns_initfiles_dir.display(),
e
);
}

if let Err(e) = tokio::fs::write(&hns_data_file_path, cache_json_clone).await {
eprintln!("Warning: Failed to write cache data to second file: {}", e);
// Create the cache_sources file in the second location
let hns_data_file_path = hns_initfiles_dir.join("cache_sources");

if let Err(e) = tokio::fs::write(&hns_data_file_path, cache_json_clone).await {
eprintln!("Warning: Failed to write cache data to second file: {}", e);
}
}

let mut tasks = tokio::task::JoinSet::<Result<()>>::new();
Expand Down
Loading