package Ġcom . github . kind rat . pres id io Ċ Ċ import Ġcom . github . kind rat . pres id io . Channel Factory . new Channel Ċ import Ġio . grpc . Server Builder Ċ import Ġmu . Kotlin Logging Ċ import Ġtypes . Analyze Service Grpc Ċ import Ġtypes . An onym ize Service Grpc Ċ Ċ private Ġval Ġlogger Ġ= ĠKotlin Logging . logger Ġ{} Ċ Ċ fun Ġmain ( var arg Ġargs : ĠString ) Ġ{ ĊĠĠĠ Ġval Ġserver Port Ġ= ĠSystem . getenv ()[" APP _ SERVER _ PORT "] ?. toInt () Ġ?: Ġ 9 0 0 0 ĊĊĠĠĠ Ġval Ġanalyzer Host Ġ= ĠSystem . getenv ()[" ANAL YZ ER _ HOST "] Ġ?: Ġ" localhost " ĊĠĠĠ Ġval Ġanalyzer Port Ġ= ĠSystem . getenv ()[" ANAL YZ ER _ PORT "] ?. toInt () Ġ?: Ġ 3 0 0 0 ĊĊĠĠĠ Ġval Ġan onym izer Host Ġ= ĠSystem . getenv ()[" AN ONY MI Z ER _ HOST "] Ġ?: Ġ" localhost " ĊĠĠĠ Ġval Ġan onym izer Port Ġ= ĠSystem . getenv ()[" AN ONY MI Z ER _ PORT "] ?. toInt () Ġ?: Ġ 3 0 0 1 ĊĊĠĠĠ Ġval Ġanalysis Client Ġ= ĠAn alyze Service Grpc . new Blocking Stub ( new Channel ( analyzer Host , Ġanalyzer Port )) ĊĠĠĠ Ġval Ġclient Ġ= ĠAn onym ize Service Grpc . new Blocking Stub ( new Channel ( anon ym izer Host , Ġan onym izer Port )) ĊĠĠĠ Ġval Ġevent Server Ġ= ĠServer Builder . for Port ( server Port ) ĊĠĠĠĠĠĠĠ Ġ. add Service ( Pres id io ServiceImpl ( analysis Client , Ġclient )) ĊĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠ Ġevent Server . start () ĊĠĠĠ Ġlogger . info Ġ{ Ġ" Pres id io Sandbox ĠServer Ġis Ġstarted Ġon Ġport Ġ$ server Port " Ġ} ĊĊĠĠĠ ĠRuntime . get Runtime (). add Shutdown Hook ( Thread Ġ{ Ġevent Server . shutdown () Ġ}) ĊĠĠĠ Ġevent Server . await Termination () Ċ }