|
39 | 39 | import org.apache.http.message.BasicNameValuePair; |
40 | 40 | import org.apache.http.ssl.SSLContextBuilder; |
41 | 41 | import org.apache.http.util.EntityUtils; |
42 | | - |
| 42 | +// Importing java-dotenv package |
43 | 43 | import io.github.cdimascio.dotenv.Dotenv; |
44 | 44 |
|
45 | 45 | /* |
@@ -340,28 +340,34 @@ public synchronized void isLoggedIn(boolean isLoggedIn) |
340 | 340 | } |
341 | 341 | } |
342 | 342 |
|
| 343 | + /** |
| 344 | + * Loading RTO credentials and API Endpoint configurations from system environment variables and .env file |
| 345 | + */ |
343 | 346 | static void readDotENV(){ |
| 347 | + // Populate configurations from the system environment variables and .env file |
344 | 348 | Dotenv dotenv = Dotenv.configure().ignoreIfMissing().ignoreIfMalformed().load(); |
345 | | - System.out.println(dotenv.get("USERNAME")); |
| 349 | + System.out.println(dotenv.get("USERNAME")); //Get system configuration |
| 350 | + //Get RTO credentials |
346 | 351 | user = dotenv.get("RTO_USER"); |
347 | 352 | password = dotenv.get("RTO_PASSWORD"); |
348 | 353 | clientid = dotenv.get("RTO_APP_KEY"); |
349 | | - |
350 | | - port = dotenv.get("RTO_WS_PORT"); |
351 | 354 | newPassword = dotenv.get("RTO_WS_NEW_PASSWORD"); |
352 | | - |
| 355 | + //Get RTO Endpoints |
353 | 356 | String baseUrl = dotenv.get("RDP_BASE_URL"); |
354 | 357 | authUrl = baseUrl + dotenv.get("RDP_AUTH_URL"); |
355 | 358 | discoveryUrl = baseUrl + dotenv.get("RDP_DISCOVERY_URL"); |
| 359 | + |
| 360 | + port = dotenv.get("RTO_WS_PORT"); |
356 | 361 | } |
357 | 362 |
|
358 | 363 | public static void main(String[] args) { |
359 | 364 |
|
| 365 | + // Read configurations from system environment variables and .env file |
360 | 366 | readDotENV(); |
361 | 367 |
|
| 368 | + // Build command line arguments parser |
362 | 369 | Options options = new Options(); |
363 | 370 |
|
364 | | - |
365 | 371 | options.addOption(Option.builder().longOpt("app_id").hasArg().desc("app_id").build()); |
366 | 372 | options.addOption(Option.builder().longOpt("position").hasArg().desc("position").build()); |
367 | 373 | options.addOption(Option.builder().longOpt("ric").hasArg().desc("ric").build()); |
|
0 commit comments