@@ -72,27 +72,15 @@ func LoadNetworks(
7272 return nil , fmt .Errorf ("failed to load network config: %w" , err )
7373 }
7474
75- // Try to load from domain config first
75+ // Load network types from domain config
7676 domainConfigPath := filepath .Join (dom .ConfigDomainFilePath ())
7777 if _ , statErr := os .Stat (domainConfigPath ); statErr != nil {
78- // Domain config doesn't exist, use legacy logic
79- networkTypes , legacyErr := getLegacyNetworkTypes (env , dom , lggr )
80- if legacyErr != nil {
81- return nil , fmt .Errorf ("failed to determine network types: %w" , legacyErr )
82- }
83- lggr .Infof ("Loaded %s Networks for %s/%s" , networkTypes , dom .Key (), env )
84-
85- return cfg .FilterWith (config_network .TypesFilter (networkTypes ... )), nil
78+ return nil , fmt .Errorf ("domain config not found at %s: %w" , domainConfigPath , statErr )
8679 }
8780
88- // Happy path: domain config exists, try to load it
8981 networkTypes , err := loadDomainConfigNetworkTypes (env , dom )
9082 if err != nil {
91- lggr .Warnf ("Failed to load domain config, falling back to legacy logic: %v" , err )
92- networkTypes , err = getLegacyNetworkTypes (env , dom , lggr )
93- if err != nil {
94- return nil , fmt .Errorf ("failed to determine network types: %w" , err )
95- }
83+ return nil , fmt .Errorf ("failed to load domain config network types: %w" , err )
9684 }
9785
9886 lggr .Infof ("Loaded %s Networks for %s/%s" , networkTypes , dom .Key (), env )
@@ -155,33 +143,3 @@ func loadDomainConfigNetworkTypes(env string, dom domain.Domain) ([]config_netwo
155143
156144 return networkTypes , nil
157145}
158-
159- // getLegacyNetworkTypes returns network types based on legacy switch logic.
160- func getLegacyNetworkTypes (env string , dom domain.Domain , lggr logger.Logger ) ([]config_network.NetworkType , error ) {
161- var networkTypes []config_network.NetworkType
162- switch env {
163- case Local , StagingTestnet , ProdTestnet :
164- networkTypes = []config_network.NetworkType {config_network .NetworkTypeTestnet }
165- case StagingMainnet , ProdMainnet :
166- networkTypes = []config_network.NetworkType {config_network .NetworkTypeMainnet }
167- case Prod :
168- networkTypes = []config_network.NetworkType {config_network .NetworkTypeTestnet , config_network .NetworkTypeMainnet }
169- // The following environments are legacy environments that are used to support domains which
170- // have not transitioned to the new environment structure.
171- case Testnet , SolStaging :
172- networkTypes = []config_network.NetworkType {config_network .NetworkTypeTestnet }
173- case Staging :
174- if dom .Key () == "data-streams" {
175- networkTypes = []config_network.NetworkType {config_network .NetworkTypeTestnet , config_network .NetworkTypeMainnet }
176- } else {
177- networkTypes = []config_network.NetworkType {config_network .NetworkTypeTestnet }
178- }
179- case Mainnet :
180- networkTypes = []config_network.NetworkType {config_network .NetworkTypeMainnet }
181- default :
182- lggr .Errorf ("Unknown environment: %s" , env )
183- return nil , fmt .Errorf ("unknown env: %s" , env )
184- }
185-
186- return networkTypes , nil
187- }
0 commit comments