package com.ippon.jug.slip;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.InetAddress;
import java.net.UnknownHostException;

@RestController
public class SlipController {

    @RequestMapping(value = "/request")
    public String getRequest() throws InterruptedException, UnknownHostException {
        this.doSlip();
        return "Hello I'm " + InetAddress.getLocalHost().getHostName();
    }

    private static final int SLEEP_MILLIS = 50;

    private synchronized void doSlip() throws InterruptedException {
        Thread.sleep(SLEEP_MILLIS);
    }

    @RequestMapping(value = "/dockerHealth")
    public ResponseEntity<Void> getHealth() {
        return new ResponseEntity<Void>(HttpStatus.INTERNAL_SERVER_ERROR);
    }
}

@@ -241,16 +241,44 @@
 oller;%0A%0A
+import java.io.IOException;%0A
 import j
@@ -335,16 +335,72 @@
 ception;
+%0Aimport java.nio.file.Files;%0Aimport java.nio.file.Paths;
 %0A%0A@RestC
@@ -586,24 +586,25 @@
 Slip();%0A
+%0A
         
 return %22
@@ -599,68 +599,481 @@
     
-return %22Hello I'm %22 + InetAddress.getLocalHost().getHostName
+StringBuilder builder = new StringBuilder()%0A                .append(%22Hello I'm %22)%0A                .append(InetAddress.getLocalHost().getHostName())%0A                .append(%22. My little secret is ... %22);%0A        try %7B%0A            Files.readAllLines(Paths.get(%22/run/secrets/bdx%22))%0A                    .forEach(builder::append);%0A        %7D catch (IOException e) %7B%0A            // No secret here%0A            builder.append(%22 UNKNOWN !%22);%0A        %7D%0A        return builder.toString
 ();%0A

Add secrets read to the slip application