#!/usr/bin/env elixir # Quick test to verify network name detection is working # Load the configuration and modules Code.eval_file("config/config.exs") Code.eval_file("config/upstream_networks.exs") alias DaProductApp.Switch.UpstreamConnection IO.puts("🔧 Testing Network Name Detection") IO.puts("=" <> String.duplicate("-", 40)) # Test the configuration reading upstream_networks = Application.get_env(:da_product_app, :upstream_networks, %{}) IO.puts("Available networks: #{inspect(Map.keys(upstream_networks))}") # Test ysp_plain config ysp_plain_config = Map.get(upstream_networks, :ysp_plain) if ysp_plain_config do network_name = Map.get(ysp_plain_config, :network_name, "unknown") IO.puts("YSP Plain network_name: #{network_name}") IO.puts("Is YSP network?: #{UpstreamConnection.is_ysp_network?(network_name)}") else IO.puts("❌ YSP Plain config not found") end # Test ysp_ssl config ysp_ssl_config = Map.get(upstream_networks, :ysp_ssl) if ysp_ssl_config do network_name = Map.get(ysp_ssl_config, :network_name, "unknown") IO.puts("YSP SSL network_name: #{network_name}") IO.puts("Is YSP network?: #{UpstreamConnection.is_ysp_network?(network_name)}") else IO.puts("❌ YSP SSL config not found") end IO.puts("") IO.puts("✅ Network detection test complete")