Skip to content

Commit

Permalink
Update main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan6sha committed Mar 3, 2024
1 parent 2a1ae7d commit a6bb759
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion modules/initipfs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,21 @@ func updateIPFSConfigIdentity(ipfsCfg *IPFSConfig, cfg ConfigYAML) {
}

func updateDatastorePath(ipfsCfg *IPFSConfig, newPath string, apiIp string) {
// Update the path to the new specified path
// Ensure Datastore.Spec is a pointer (if it isn't already)
if ipfsCfg.Datastore.Spec == nil {
ipfsCfg.Datastore.Spec = &struct {
Child *struct {
Path string `json:"path"`
SyncWrites bool `json:"syncWrites"`
Truncate bool `json:"truncate"`
Type string `json:"type"`
} `json:"child"`
Prefix string `json:"prefix"`
Type string `json:"type"`
}{}
}

// Directly modify the fields via the pointers
ipfsCfg.Datastore.Spec.Child.Path = newPath
ipfsCfg.Datastore.Spec.Child.SyncWrites = true
// Update the path to the new specified path
Expand Down

0 comments on commit a6bb759

Please sign in to comment.