diff --git a/config b/config index 75a784b..74863b5 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit 75a784ba6ed8f6e70ee91808d3752443e3a04d1d +Subproject commit 74863b5222f054ae8f394f986f4524f29178b40b diff --git a/config_server/src/main/resources/config-server.jks b/config_server/src/main/resources/config-server.jks index 6985682..46e23f7 100644 Binary files a/config_server/src/main/resources/config-server.jks and b/config_server/src/main/resources/config-server.jks differ diff --git a/users/src/main/java/ba/steleks/SteleksServiceApplication.java b/users/src/main/java/ba/steleks/SteleksServiceApplication.java index 6f751b3..2f253d4 100644 --- a/users/src/main/java/ba/steleks/SteleksServiceApplication.java +++ b/users/src/main/java/ba/steleks/SteleksServiceApplication.java @@ -2,14 +2,17 @@ package ba.steleks; import ba.steleks.storage.StorageProperties; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.discovery.DiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.util.List; @@ -27,9 +30,26 @@ public class SteleksServiceApplication { @RestController class ServiceInstanceRestController { - @Autowired + private DiscoveryClient discoveryClient; + @Autowired + public ServiceInstanceRestController(DiscoveryClient discoveryClient) { + this.discoveryClient=discoveryClient; + } + + @Value("${user.password}") + private String password; + + @RequestMapping( + value = "/whoami/{username}", + method = RequestMethod.GET, + produces = MediaType.TEXT_PLAIN_VALUE) + public String whoami(@PathVariable("username") String username) { + return String.format("Hello! You're %s and you'll become Developer, " + + "but only if your password is '%s'!\n", username, password); + } + @RequestMapping("/service-instances/{applicationName}") public List serviceInstancesByApplicationName( @PathVariable String applicationName) { diff --git a/users/src/main/resources/bootstrap.properties b/users/src/main/resources/bootstrap.properties index be741b1..2fb44bd 100644 --- a/users/src/main/resources/bootstrap.properties +++ b/users/src/main/resources/bootstrap.properties @@ -2,4 +2,4 @@ spring.application.name=users # N.B. this is the default: spring.cloud.config.uri=http://localhost:8888 spring.cloud.config.username=root -spring.cloud.config.password=root \ No newline at end of file +spring.cloud.config.password=root