diff --git a/cmd/main.go b/cmd/main.go index 0b9f69c..dc6d83f 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -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" + FILE_PATH = "resources/AppConfig.json" ) 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() }