package de.ozgcloud.admin.environment; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.*; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import de.ozgcloud.admin.RootController; import lombok.RequiredArgsConstructor; @RestController("ozgCloudEnvironmentController") @RequiredArgsConstructor @RequestMapping(EnvironmentController.PATH) public class EnvironmentController { static final String PATH = "/api/environment"; // NOSONAR private final ProductionProperties environmentProperties; private final OAuth2Properties oAuthProperties; @GetMapping public Environment getEnvironment() { return Environment.builder() .production(environmentProperties.isProduction()) .remoteHost(linkTo(RootController.class).toUri().toString()) .authServer(oAuthProperties.getAuthServerUrl()) .realm(oAuthProperties.getRealm()) .clientId(oAuthProperties.getResource()) .build(); } }