mirror of
https://github.com/mudler/LocalAI.git
synced 2024-12-18 20:27:57 +00:00
fix(p2p): parse maddr correctly (#4219)
Previously in case of not specifying a value it would pass a slice of 1 empty element Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
fa6fcdf53e
commit
47dc4337ba
@ -386,8 +386,20 @@ func newNodeOpts(token string) ([]node.Option, error) {
|
|||||||
// TODO: move this up, expose more config options when creating a node
|
// TODO: move this up, expose more config options when creating a node
|
||||||
noDHT := os.Getenv("LOCALAI_P2P_DISABLE_DHT") == "true"
|
noDHT := os.Getenv("LOCALAI_P2P_DISABLE_DHT") == "true"
|
||||||
noLimits := os.Getenv("LOCALAI_P2P_ENABLE_LIMITS") == "true"
|
noLimits := os.Getenv("LOCALAI_P2P_ENABLE_LIMITS") == "true"
|
||||||
listenMaddrs := strings.Split(os.Getenv("LOCALAI_P2P_LISTEN_MADDRS"), ",")
|
|
||||||
bootstrapPeers := strings.Split(os.Getenv("LOCALAI_P2P_BOOTSTRAP_PEERS_MADDRS"), ",")
|
var listenMaddrs []string
|
||||||
|
var bootstrapPeers []string
|
||||||
|
|
||||||
|
laddrs := os.Getenv("LOCALAI_P2P_LISTEN_MADDRS")
|
||||||
|
if laddrs != "" {
|
||||||
|
listenMaddrs = strings.Split(laddrs, ",")
|
||||||
|
}
|
||||||
|
|
||||||
|
bootmaddr := os.Getenv("LOCALAI_P2P_BOOTSTRAP_PEERS_MADDRS")
|
||||||
|
if bootmaddr != "" {
|
||||||
|
bootstrapPeers = strings.Split(bootmaddr, ",")
|
||||||
|
}
|
||||||
|
|
||||||
dhtAnnounceMaddrs := stringsToMultiAddr(strings.Split(os.Getenv("LOCALAI_P2P_DHT_ANNOUNCE_MADDRS"), ","))
|
dhtAnnounceMaddrs := stringsToMultiAddr(strings.Split(os.Getenv("LOCALAI_P2P_DHT_ANNOUNCE_MADDRS"), ","))
|
||||||
|
|
||||||
libp2ploglevel := os.Getenv("LOCALAI_P2P_LIB_LOGLEVEL")
|
libp2ploglevel := os.Getenv("LOCALAI_P2P_LIB_LOGLEVEL")
|
||||||
|
Loading…
Reference in New Issue
Block a user