Modifying the handler to source these environment variables

Now, the handler needs to be modified to source the configuration from the environment variables by using "System.getEnv(String variableName)".

The modified code looks as follows: 

@Override    public String handleRequest(String greetee, Context context) {    LambdaLogger logger = context.getLogger();    logger.log("Lets greet "+ greetee);    String userName = System.getenv("databaseUsername");    String password =  System.getenv("databasePassword");    String databaseUrl = System.getenv("databaseUrl");    String databasePort = System.getenv("databasePort");    String databaseName = System.getenv("databaseName");    StringBuilder sb = new StringBuilder();    sb.append("jdbc:postgresql://"); sb.append(databaseUrl); ...

Get Hands-On Serverless Applications with Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.