From c9005f10d4bfed7a45cfb56352b8054514c11f6b Mon Sep 17 00:00:00 2001 From: ehsan shariati Date: Sat, 24 Feb 2024 11:47:58 +0100 Subject: [PATCH] Update main.go --- modules/initipfs/main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/initipfs/main.go b/modules/initipfs/main.go index 20eea3a..59a564c 100644 --- a/modules/initipfs/main.go +++ b/modules/initipfs/main.go @@ -178,6 +178,7 @@ func main() { updateIPFSConfigIdentity(&ipfsCfg, config) updateIPFSConfigBootstrap(&ipfsCfg, config.IpfsBootstrapNodes, users) + updateDatastorePath(&ipfsCfg, "/internal/badgerds") writeIPFSConfig(ipfsConfigPath, ipfsCfg) writePredefinedFiles() @@ -324,6 +325,14 @@ func updateIPFSConfigIdentity(ipfsCfg *IPFSConfig, cfg ConfigYAML) { ipfsCfg.Identity.PeerID = generatePeerIDFromIdentity(cfg.Identity) } +func updateDatastorePath(ipfsCfg *IPFSConfig, newPath string) { + // Check if the Datastore.Spec.child is not nil and the path exists + if ipfsCfg.Datastore.Spec.Child.Path != "" { + // Update the path to the new specified path + ipfsCfg.Datastore.Spec.Child.Path = newPath + } +} + func generatePeerIDFromIdentity(identity string) string { // Decode the base64 encoded identity to get the private key bytes privateKeyBytes, err := base64.StdEncoding.DecodeString(identity)