Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/fuzzy-mice-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink-deployments-framework": patch
---

fix(network): stop loading all yamls in .config
16 changes: 8 additions & 8 deletions engine/cld/config/networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,31 @@ func LoadNetworks(
return cfg.FilterWith(cfgnet.TypesFilter(networkTypes...)), nil
}

// loadNetworkConfig loads the network config from the .config directory in the given fdomain.
// loadNetworkConfig loads the network config from the .config/networks directory in the given fdomain.
func loadNetworkConfig(domain fdomain.Domain) (*cfgnet.Config, error) {
// Check if the .config directory exists in the domain
configDir := filepath.Join(domain.DirPath(), ".config")
if _, err := os.Stat(configDir); err != nil {
// Check if the .config/networks directory exists in the domain
configNetworkDir := domain.ConfigNetworksDirPath()
if _, err := os.Stat(configNetworkDir); err != nil {
return nil, fmt.Errorf("cannot find config directory: %w", err)
}

// Find all yaml config files in the .config directory and any subdirectories
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we still retain the subdirectories here? Not sure if this will affect any domains

Copy link
Collaborator Author

@graham-chainlink graham-chainlink Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what i learnt is that ** only matches 1 directory. Nested recursion never worked. ** is behaves exactly as *

If i have these files under .config/

   [0 level(s)] direct.yaml
   [1 level(s)] local/local.yaml
   [1 level(s)] networks/networks.yaml
   [3 level(s)] networks/sub1/sub2/deep.yaml
   [2 level(s)] networks/subdir/nested.yaml
   Total: 5 files

Files matched by ymlFiles, err := filepath.Glob(filepath.Join(configDir, "**", "*.yaml"))

   ✅ [1 level(s)] local/local.yaml
   ✅ [1 level(s)] networks/networks.yaml
   Total: 2 files
   ❌ [0 level(s)] direct.yaml
   ❌ [3 level(s)] networks/sub1/sub2/deep.yaml
   ❌ [2 level(s)] networks/subdir/nested.yaml
   Total: 3 files

My change basically just ensure instead of ** , we match networks

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great thanks!I didn't know that

// Find all yaml config files in the .config/networks directory
var configFiles []string

yamlFiles, err := filepath.Glob(filepath.Join(configDir, "**", "*.yaml"))
yamlFiles, err := filepath.Glob(filepath.Join(configNetworkDir, "*.yaml"))
if err != nil {
return nil, fmt.Errorf("failed to find config files: %w", err)
}
configFiles = append(configFiles, yamlFiles...)

ymlFiles, err := filepath.Glob(filepath.Join(configDir, "**", "*.yml"))
ymlFiles, err := filepath.Glob(filepath.Join(configNetworkDir, "*.yml"))
if err != nil {
return nil, fmt.Errorf("failed to find config files: %w", err)
}
configFiles = append(configFiles, ymlFiles...)

if len(configFiles) == 0 {
return nil, fmt.Errorf("no config files found in %s", configDir)
return nil, fmt.Errorf("no config files found in %s", configNetworkDir)
}

cfg, err := cfgnet.Load(configFiles)
Expand Down