Commit initial
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package com.capgemini.fridaybooster.kubernetes.fbapp;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class FBApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(FBApp.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.capgemini.fridaybooster.kubernetes.fbapp.controller;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.capgemini.fridaybooster.kubernetes.fbapp.model.HostNameInfo;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/")
|
||||
public class TestController {
|
||||
|
||||
private final HostNameInfo infos;
|
||||
|
||||
public TestController(@Value("${message}") String message) throws UnknownHostException {
|
||||
var ip = Inet4Address.getLocalHost().getHostAddress();
|
||||
var hostName = Inet4Address.getLocalHost().getHostName();
|
||||
|
||||
infos = new HostNameInfo(hostName, ip, message);
|
||||
}
|
||||
|
||||
@GetMapping("/")
|
||||
public Mono<HostNameInfo> getInfo() {
|
||||
return Mono.just(infos);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.capgemini.fridaybooster.kubernetes.fbapp.model;
|
||||
|
||||
public class HostNameInfo {
|
||||
|
||||
private final String hostname;
|
||||
|
||||
private final String ip;
|
||||
|
||||
private final String message;
|
||||
|
||||
public HostNameInfo(String hostname, String ip, String message) {
|
||||
super();
|
||||
this.hostname = hostname;
|
||||
this.ip = ip;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
1
fb-app/src/main/resources/application.yaml
Normal file
1
fb-app/src/main/resources/application.yaml
Normal file
@@ -0,0 +1 @@
|
||||
message: ${ENV_MESSAGE:La variable 'ENV_MESSAGE' n'est pas definie}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.capgemini.fridaybooster.kubernetes.fbapp;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class TestApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user