Replace project constant by dynamic AppConfig.
This commit is contained in:
parent
0808ed493d
commit
dfd6096898
@ -7,13 +7,11 @@ import (
|
||||
"StorBackEnd/pkg/protocol/repository"
|
||||
"StorBackEnd/pkg/protocol/rules/readers"
|
||||
"StorBackEnd/pkg/protocol/rules/writers"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
FILE_PATH = "resources/AppConfig.json"
|
||||
MULTICAST_ADDRESS = "226.66.66.1:42500"
|
||||
MULTICAST_SECOND = 10 // TODO : Changer en 30 secondes
|
||||
UNICAST_ADDRESS = "0.0.0.0:58000"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -38,12 +36,12 @@ func main() {
|
||||
eraseFileRule := readers.CreateEraseFileRule("^ERASEFILE ([A-Za-z0-9.]{50,200})\r\n$")
|
||||
protocolRepository.AddReader(&eraseFileRule)
|
||||
|
||||
multicast := network.CreateClientMulticast(MULTICAST_ADDRESS, MULTICAST_SECOND, protocolRepository)
|
||||
multicast := network.CreateClientMulticast(appConfig.MulticastAddress, time.Duration(appConfig.MulticastSecond), protocolRepository)
|
||||
go multicast.Run()
|
||||
|
||||
requestManager := managers.RequestManager{Repository: protocolRepository}
|
||||
|
||||
server := network.ServerUnicast{Network: "tcp", Address: UNICAST_ADDRESS, ReqManager: &requestManager}
|
||||
server := network.ServerUnicast{Network: "tcp", Address: appConfig.UnicastAddress, ReqManager: &requestManager}
|
||||
server.Run()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user