Skip to content

Commit a9f6554

Browse files
committed
re-read after ipfs config copy
1 parent d809bfb commit a9f6554

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

modules/initipfs/main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,16 @@ func main() {
206206
ipfsCfg, err = readIPFSConfig(defaultIpfsConfig, ipfsConfigPath)
207207
if err != nil {
208208
if os.IsNotExist(err) {
209-
// File doesn't exist, create it in main
209+
// File doesn't exist, copy the template to disk
210210
if err := copyDefaultIPFSConfig(defaultIpfsConfig, ipfsConfigPath); err != nil {
211211
panic(fmt.Sprintf("Failed to create empty config file: %v", err))
212212
}
213+
// Re-read the just-copied config so ipfsCfg has the template values
214+
ipfsCfg, err = readIPFSConfig(defaultIpfsConfig, ipfsConfigPath)
215+
if err != nil {
216+
panic(fmt.Sprintf("Failed to read IPFS config after copying template: %v", err))
217+
}
213218
} else {
214-
// Unexpected error, handle appropriately (e.g., logging, retrying)
215-
// For now, panic for demonstration:
216219
panic(fmt.Sprintf("Failed to read or create IPFS config: %v", err))
217220
}
218221
}

0 commit comments

Comments
 (0)