@Override public NativeEnvironmentRepository build(NativeEnvironmentProperties environmentProperties) { NativeEnvironmentRepository repository = new NativeEnvironmentRepository(environment, environmentProperties); if(properties.getDefaultLabel() != null) { repository.setDefaultLabel(properties.getDefaultLabel()); } return repository; } }
@Override public synchronized Environment findOne(String application, String profile, String label) { NativeEnvironmentRepository delegate = new NativeEnvironmentRepository(getEnvironment(), new NativeEnvironmentProperties()); Locations locations = getLocations(application, profile, label); delegate.setSearchLocations(locations.getLocations()); Environment result = delegate.findOne(application, profile, ""); result.setVersion(locations.getVersion()); result.setLabel(label); return this.cleaner.clean(result, getWorkingDirectory().toURI().toString(), getUri()); }
@Override public PropertySource<?> locate(org.springframework.core.env.Environment environment) { final ConfigurableEnvironment configurableEnvironment = (ConfigurableEnvironment) environment; final NativeEnvironmentRepository springEnv = new NativeEnvironmentRepository(configurableEnvironment); final List<File> propertiesPath = getConfigDirs(); //https://github.com/spring-cloud/spring-cloud-config/issues/338 springEnv.setSearchLocations(toSearchLocations(propertiesPath)); CompositePropertySource composite = new CompositePropertySource(FileSystemLocator.class.getSimpleName()); addToPropertySource(returnPropertiesForName(springEnv, appCoordinates.getApplicationNameWithCountry()), composite); addToPropertySource(returnPropertiesForName(springEnv, appCoordinates.getApplicationNameWithoutCountry()), composite); addToPropertySource(returnPropertiesForName(springEnv, ConfigLocations.BASE_FILENAME_FOR_GLOBAL_CONFIG), composite); return composite; }