refactor: replace all api_gateway/web-gateway references across codebase

- Rename test functions, variables, bench names (api_gateway → api)
- Update e2e orchestrator executable path (target/debug/api)
- Clean Grafana dashboards: remove dead web-gateway panels, fix trailing
  pipes/commas, update pod selectors
- Update metrics_validation test metric prefixes (api_gateway_ → api_)
- Fix .gitlab-ci.yml remaining path reference
- Fix FXT CLI test flag and function names
- Keep JWT issuer foxhunt-api-gateway (cross-service auth compat)
- Keep serde alias api_gateway_url (config backwards compat)

cargo check --workspace passes cleanly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-03-05 00:18:58 +01:00
parent 84877e5146
commit 075f715fa1
16 changed files with 107 additions and 267 deletions

View File

@@ -194,7 +194,7 @@ async fn start_services(matches: &ArgMatches) -> Result<()> {
let background = matches.get_flag("background");
// API Gateway gets port 50051, backend services start at 50052
let api_gateway_port: u16 = 50051;
let api_port: u16 = 50051;
let backend_base_port: u16 = 50052;
// Get JWT_SECRET from environment (required for API Gateway)
@@ -209,7 +209,7 @@ async fn start_services(matches: &ArgMatches) -> Result<()> {
let ml_training_service_url = format!("http://localhost:{}", backend_base_port + 2);
info!("Starting services: {}", services_arg);
info!("API Gateway port: {}", api_gateway_port);
info!("API service port: {}", api_port);
info!("Backend services starting at port: {}", backend_base_port);
info!("Background mode: {}", background);
@@ -245,41 +245,41 @@ async fn start_services(matches: &ArgMatches) -> Result<()> {
// Start API Gateway FIRST if requested
if services_to_start.contains(&ServiceType::ApiGateway) || services_to_start.len() > 1 {
info!("Starting API Gateway on port {}...", api_gateway_port);
info!("Starting API service on port {}...", api_port);
let mut api_gateway_env = HashMap::new();
api_gateway_env.insert("JWT_SECRET".to_string(), jwt_secret.clone());
api_gateway_env.insert(
let mut api_env = HashMap::new();
api_env.insert("JWT_SECRET".to_string(), jwt_secret.clone());
api_env.insert(
"TRADING_SERVICE_URL".to_string(),
trading_service_url.clone(),
);
api_gateway_env.insert(
api_env.insert(
"BACKTESTING_SERVICE_URL".to_string(),
backtesting_service_url.clone(),
);
api_gateway_env.insert(
api_env.insert(
"ML_TRAINING_SERVICE_URL".to_string(),
ml_training_service_url.clone(),
);
api_gateway_env.insert("GRPC_PORT".to_string(), api_gateway_port.to_string());
api_gateway_env.insert("HTTP_PORT".to_string(), "8080".to_string());
api_gateway_env.insert("METRICS_PORT".to_string(), "9091".to_string());
api_gateway_env.insert("RUST_LOG".to_string(), "info".to_string());
api_gateway_env.insert("FOXHUNT_TEST_MODE".to_string(), "true".to_string());
api_env.insert("GRPC_PORT".to_string(), api_port.to_string());
api_env.insert("HTTP_PORT".to_string(), "8080".to_string());
api_env.insert("METRICS_PORT".to_string(), "9091".to_string());
api_env.insert("RUST_LOG".to_string(), "info".to_string());
api_env.insert("FOXHUNT_TEST_MODE".to_string(), "true".to_string());
let api_gateway_config = ServiceConfig {
let api_config = ServiceConfig {
service_type: ServiceType::ApiGateway,
executable_path: "target/debug/api_gateway".to_string(),
port: api_gateway_port,
executable_path: "target/debug/api".to_string(),
port: api_port,
health_endpoint: "http://localhost:8080/health".to_string(),
startup_timeout: Duration::from_secs(30),
environment: api_gateway_env,
environment: api_env,
working_directory: std::env::current_dir()?,
log_file: Some("/tmp/foxhunt_api_gateway_service.log".to_string()),
log_file: Some("/tmp/foxhunt_api_service.log".to_string()),
};
service_manager.start_service(api_gateway_config).await?;
profiler.checkpoint("api_gateway_started");
service_manager.start_service(api_config).await?;
profiler.checkpoint("api_started");
// Wait for API Gateway to be ready
if wait_ready {
@@ -699,7 +699,7 @@ fn parse_service_list(services_str: &str) -> Result<Vec<ServiceType>> {
];
break;
},
"api_gateway" | "gateway" => services.push(ServiceType::ApiGateway),
"api" | "api_gateway" | "gateway" => services.push(ServiceType::ApiGateway),
"trading" => services.push(ServiceType::TradingService),
"backtesting" => services.push(ServiceType::BacktestingService),
"ml_training" | "ml" => services.push(ServiceType::MLTrainingService),
@@ -715,7 +715,7 @@ fn create_service_config(service_type: &ServiceType, port: u16) -> Result<Servic
let (health_endpoint, executable_path) = match service_type {
ServiceType::ApiGateway => (
"http://localhost:8080/health".to_string(),
"api_gateway".to_string(),
"api".to_string(),
),
ServiceType::TradingService => (
"http://localhost:8081/health".to_string(),

View File

@@ -24,7 +24,7 @@ pub enum ServiceType {
impl ServiceType {
pub fn as_str(&self) -> &str {
match self {
ServiceType::ApiGateway => "api_gateway",
ServiceType::ApiGateway => "api",
ServiceType::TradingService => "trading",
ServiceType::BacktestingService => "backtesting",
ServiceType::MLTrainingService => "ml_training",