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 @RequiredArgsConstructor @RequestMapping(FrontendEnvironmentController.PATH) public class FrontendEnvironmentController { static final String PATH = "/api/frontendEnvironment"; // NOSONAR private final ProductionProperties environmentProperties; private final OAuth2Properties oAuthProperties; @GetMapping public FrontendEnvironment getEnvironment() { return FrontendEnvironment.builder() .production(environmentProperties.isProduction()) .remoteHost(linkTo(RootController.class).toUri().toString()) .authServer(oAuthProperties.getAuthServerUrl()) .realm(oAuthProperties.getRealm()) .clientId(oAuthProperties.getResource()) .build(); } }