packages/hyprspace: better swarm key handling

This commit is contained in:
Max Headroom 2022-09-25 23:37:25 +02:00
parent a1ddafe045
commit 8b6e5b831c

View file

@ -63,9 +63,15 @@ func CreateNode(ctx context.Context, inputKey string, port int, handler network.
return return
} }
swarmKey, err := os.Open(os.Getenv("HYPRSPACE_SWARM_KEY")) var swarmKey *os.File
if err != nil { swarmKeyFile, ok := os.LookupEnv("HYPRSPACE_SWARM_KEY")
return if ok {
fmt.Println("[+] Using swarm key " + swarmKeyFile)
swarmKey, err = os.Open(swarmKeyFile)
if err != nil {
return
}
defer swarmKey.Close()
} }
extraBootstrapNodes := []string{} extraBootstrapNodes := []string{}
ipfsApiStr, ok := os.LookupEnv("HYPRSPACE_IPFS_API") ipfsApiStr, ok := os.LookupEnv("HYPRSPACE_IPFS_API")