@Override public String toString() { return this.propertySource.toString(); }
@Override public String toString() { return this.propertySource.toString(); }
@Override protected void doHealthCheck(Builder builder) throws Exception { PropertySource<?> propertySource = getPropertySource(); builder.up(); if (propertySource instanceof CompositePropertySource) { List<String> sources = new ArrayList<>(); for (PropertySource<?> ps : ((CompositePropertySource) propertySource).getPropertySources()) { sources.add(ps.getName()); } builder.withDetail("propertySources", sources); } else if (propertySource!=null) { builder.withDetail("propertySources", propertySource.toString()); } else { builder.unknown().withDetail("error", "no property sources located"); } }
@Secured({"ROLE_ADMIN"}) @RequestMapping(value = "/internalapi/config", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ConfigValidationResult setConfig(@RequestBody BaseConfig newConfig) throws IOException { for (PropertySource<?> source : environment.getPropertySources()) { Set propertyNames = new HashSet(); if (source.getSource() instanceof Properties) { propertyNames = ((Properties) source.getSource()).stringPropertyNames(); } else if (source.getSource() instanceof LinkedHashMap) { propertyNames = ((LinkedHashMap) source.getSource()).keySet(); } boolean contains = propertyNames.contains("main.externalUrl"); if (contains) { logger.info(source.toString()); } } logger.info("Received new config"); newConfig = newConfig.prepareForSaving(); ConfigValidationResult result = newConfig.validateConfig(configProvider.getBaseConfig(), newConfig); if (result.isOk()) { configProvider.getBaseConfig().replace(newConfig); configProvider.getBaseConfig().save(); result.setNewConfig(configProvider.getBaseConfig()); } return result; }
@Override protected void doHealthCheck(Builder builder) throws Exception { PropertySource<?> propertySource = getPropertySource(); builder.up(); if (propertySource instanceof CompositePropertySource) { List<String> sources = new ArrayList<>(); for (PropertySource<?> ps : ((CompositePropertySource) propertySource).getPropertySources()) { sources.add(ps.getName()); } builder.withDetail("propertySources", sources); } else if (propertySource!=null) { builder.withDetail("propertySources", propertySource.toString()); } else { builder.unknown().withDetail("error", "no property sources located"); } }