44import io .nodelink .server .NodeLink ;
55import io .nodelink .server .app .data .BONE_LOCATION ;
66import io .nodelink .server .app .data .CLUSTER_LOCATION ;
7+ import io .nodelink .server .app .infra .CONSTANT ;
78import io .nodelink .server .app .infra .DatabaseService ;
89import io .nodelink .server .app .infra .SyncEngine ;
910import io .nodelink .server .enums .CommandsEnum ;
@@ -90,15 +91,15 @@ public CommandLogics(CommandDispatcher dispatcher, LineReader reader, Terminal t
9091 terminal .writer ().println ("Emplacement du bone défini sur : " + boneLocation .name ());
9192
9293 HttpRequest idRequest = HttpRequest .newBuilder ()
93- .uri (URI .create ("http://localhost:8080 /bone/api/v1/getId" ))
94+ .uri (URI .create ("http://localhost:" + CONSTANT . PORT_BONE + " /bone/api/v1/getId" ))
9495 .GET ()
9596 .build ();
9697
9798 HttpResponse <String > idResponse = client .send (idRequest , HttpResponse .BodyHandlers .ofString ());
9899 int generatedId = mapper .readTree (idResponse .body ()).get ("id" ).asInt ();
99100
100101 String location = boneLocation .name ();
101- String finalUrl = String .format ("http://%d." + boneLocation .getLocation () + ".nodelinkapp.xyz:8080 " , generatedId );
102+ String finalUrl = String .format ("http://%d." + boneLocation .getLocation () + ".nodelinkapp.xyz" , generatedId );
102103
103104 String registrationJson = String .format (
104105 "{\" id\" : \" %d\" , \" location\" : \" %s\" , \" url\" : \" %s\" }" ,
@@ -108,7 +109,7 @@ public CommandLogics(CommandDispatcher dispatcher, LineReader reader, Terminal t
108109 );
109110
110111 HttpRequest registerReq = HttpRequest .newBuilder ()
111- .uri (URI .create ("http://localhost:8080 /bone/api/v1/addBone" ))
112+ .uri (URI .create ("http://localhost:" + CONSTANT . PORT_BONE + " /bone/api/v1/addBone" ))
112113 .header ("Content-Type" , "application/json" )
113114 .POST (HttpRequest .BodyPublishers .ofString (registrationJson ))
114115 .build ();
@@ -159,7 +160,7 @@ public CommandLogics(CommandDispatcher dispatcher, LineReader reader, Terminal t
159160 // --- PHASE 1 : Récupération de l'ID (SYNCHRONE) ---
160161 // Vérifie bien si l'URL est /bone/ ou /cluster/ dans ton RouteHandler
161162 HttpRequest idRequest = HttpRequest .newBuilder ()
162- .uri (URI .create ("http://localhost:8080 /cluster/api/v1/getId" ))
163+ .uri (URI .create ("http://localhost:" + CONSTANT . PORT_CLUSTER + " /cluster/api/v1/getId" ))
163164 .GET ()
164165 .build ();
165166
@@ -184,7 +185,7 @@ public CommandLogics(CommandDispatcher dispatcher, LineReader reader, Terminal t
184185 );
185186
186187 HttpRequest registerReq = HttpRequest .newBuilder ()
187- .uri (URI .create ("http://localhost:8080 /cluster/api/v1/addCluster" ))
188+ .uri (URI .create ("http://localhost:" + CONSTANT . PORT_CLUSTER + " /cluster/api/v1/addCluster" ))
188189 .header ("Content-Type" , "application/json" )
189190 .POST (HttpRequest .BodyPublishers .ofString (registrationJson ))
190191 .build ();
0 commit comments