207 Commits

Author SHA1 Message Date
Ryan Baxter
861ed6785e Do not combine profiles when spring.cloud.config.pofiles is set. (#2354)
Fixes #2349
2023-11-21 15:27:17 -05:00
Ryan Baxter
3910fbff56 Fix IllegalArgumentException in equals and hashcodes. Fixes #2304 (#2307)
Co-authored-by: Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com>
2023-07-16 19:14:22 -04:00
buildmaster
5bfc1577ba Bumping versions 2023-06-17 00:27:07 +00:00
Ryan Baxter
640d6d3fa8 Revert changes to adding profile specific logic (#2292)
Fixes #2279
Fixes #2289

See #2291

Co-authored-by: Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com>
2023-06-16 16:07:24 -04:00
Ryan Baxter
12597fef31 Initialize ConfigClientProperties instead of using whats in bootstrap. (#2282)
Fixes #2281

Co-authored-by: Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com>
2023-06-16 15:37:22 -04:00
Ryan Baxter
9f3ad4f04b Implement a better equals and hashcode method ConfigServerConfigDataResource (#2278)
Spring Boot keeps a list of ConfigDataResources and will call contains on the list to determine whether it should load the resource.  Our hashcode and equals methods were using variables in ConfigServerConfigDataResource which had no bearing on the configuration that would be loaded, so this change simplifies this to make sure two ConfigServerConnfigDataResources would be considered equal if they would end up making the same request to the config server for configuration.

Co-authored-by: Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com>
2023-06-16 15:34:46 -04:00
Ryan Baxter
538267a7e3 Pass binder to ConfigServerInstanceProvider (#2269)
Co-authored-by: Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com>
2023-06-12 19:33:24 -04:00
Ryan Baxter
755dffc0c2 Recreate ConfigClientProperties every time we load config data. Fixes #2274 (#2275)
Co-authored-by: Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com>
2023-06-02 12:16:32 -04:00
Ryan Baxter
6ec9c432cb Support for profile specific config data loading (#2260)
Fixes #1922

Co-authored-by: Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com>
2023-05-04 15:31:48 -04:00
Ryan Baxter
0e3b27df1c Make OriginTrackedMapPropertySource immutable. Fixes #2032 (#2237)
Co-authored-by: Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com>
2023-03-08 08:04:50 -05:00
spencergibb
70e558df7d Removes unused constructor 2022-05-09 12:22:41 -04:00
ruansheng
9cfa39377e Fix configServer logger (#2066) 2022-03-22 09:28:25 -04:00
buildmaster
9e7fd9117a Bumping versions 2022-02-24 00:30:01 +00:00
Sergii Chekotylo
d0b9f0a6c8 Unable to provide different values of spring.config.import.configserver since 2020.0.4 #2011 (#2037) 2022-02-22 11:05:29 -05:00
Mark Bonnekessel
b5ac671671 Add Option.PROFILE_SPECIFIC to profile specific PropertySources from Vault
Fixes gh-1997
2022-01-31 12:04:37 -05:00
spencergibb
0e2c4fccd1 merge FailureAnalyzer entries 2021-07-27 23:39:40 -04:00
spencergibb
fd35b6ecbd formatting 2021-07-27 23:21:51 -04:00
spencergibb
52449c06c0 Migrates tests to junit 5 and updated for bootstrap 2021-07-27 23:20:18 -04:00
spencergibb
ede086893b Merge branch 'GH-1586' of https://github.com/Walliee/spring-cloud-config into Walliee-GH-1586 2021-07-27 22:58:04 -04:00
Ryan Baxter
719e06950c Use ConfigClientProperties if it exists in the BootstrapContext (#1931)
* Use ConfigClientProperties if it exists in the BootstrapContext before creating a new one.  Fixes  #1919

* Add back test, have one test use uri from properties
2021-07-16 12:02:40 -04:00
spencergibb
e645c80215 Adds tests for retry properties in import url.
See gh-1797
2021-05-26 11:32:00 -04:00
spencergibb
e9fa34032b Adds support for retry in profile specific properties.
in application-<profile>.{properties|yaml}

spring.config.import=configserver:http://configserver.example.com?fail-fast=true&max-attempts=10&max-interval=1500&multiplier=1.2&initial-interval=1100"

This required that the RetryTemplate be created as late as possible and it is no longer put in the bootstrap context. A RetryTemplateFactory was created so the LoaderInterceptor and the ConfigServerInstanceProvider can create a RetryTemplate. ConfigServerConfigDataLocationResolver creates RetryProperties from the url parameters if they are provided.

ConfigServerConfigDataLoader now creates a ConfigClientFailFastException and registers it in the application context rather and returns an empty ConfigData rather than throwing and exception. Then in ConfigClientAutoConfiguration an ApplicationStartedEvent is listened for and if the fail fast exception is there, throws it halting execution. This all allows logging in ConfigData to show.

Fixes gh-1797
2021-05-26 11:31:03 -04:00
spencergibb
529afcda4d remove errant comment 2021-05-24 13:20:41 -04:00
spencergibb
42546c813e Migrate from deprecated Bootstrapper to BootstrapRegistryInitializer
Fixes gh-1890
2021-05-24 13:02:10 -04:00
spencergibb
be708efc18 Use boot config data api to determine resource and location.
Previously the resource name and location needed to be parsed. This change updates NativeEnvironmentRepository to pass a ConfigDataEnvironmentUpdateListener to ConfigDataEnvironmentPostProcessor.applyTo() and match PropertySources to location and resource. PassthruEnvironmentRepository is updated to attach the original PropertySource to use later in the clean() method to retrieve the location and resource avoiding parsing.

Fixes gh-1875
2021-05-05 14:12:06 -04:00
spencergibb
3056d5f842 Fixes profile ordering of remote vs local.
Previously a local profiles specific file would have more priority than a remote profile specific file. Using a new ConfigData Option, this is now fixed.

Fixes gh-1795
2021-04-08 17:39:32 -04:00
Ryan Baxter
a57b465638 Take into account config data in list format (#1853) 2021-03-31 07:01:24 -04:00
spencergibb
50d2f9d334 formatting 2021-03-29 18:07:17 -04:00
spencergibb
9b9b6838b6 Merge branch '2.2.x' 2021-03-29 18:06:37 -04:00
spencergibb
f4aab7f15d Adds support for uri encoded username/password
Fixes gh-1621
2021-03-29 18:05:06 -04:00
spencergibb
62c96d059c removes todo that has been completed 2021-03-15 20:56:20 -04:00
Ryan Baxter
964238a5f2 Use property source name in ConfigServerConfigDataLocator 2021-03-15 19:35:26 -04:00
Ryan Baxter
7f17b77853 Get all property sources for bootstrap, configserver, and configclient in health indicator 2021-03-15 16:42:41 -04:00
spencergibb
03cdebcffd Adds resource to logging 2021-03-12 18:49:39 -05:00
spencergibb
4010a7cf7c Adds support for Tls to config data.
Moves common setup to new ConfigClientRequestTemplateFactory class that was replicated between two implementations.

Fixes gh-1689
2021-03-12 18:31:25 -05:00
buildmaster
35f219c296 Bumping versions 2021-03-11 09:59:24 +00:00
spencergibb
df5bda79ff Fixes test to mock RestTemplate response. 2021-03-10 18:48:06 -05:00
spencergibb
a09d4bf3fd Adds null checks to test 2021-03-10 18:33:38 -05:00
spencergibb
587cc97b4c Adds ignore imports and profiles to ConfigData.
This allows config server to apply profiles and imports while ignoring them on the client side.

Fixes gh-1788
2021-03-10 17:55:20 -05:00
spencergibb
823d201701 fixes typo 2021-03-10 17:54:10 -05:00
spencergibb
2ea5e11c9a Fail if no configserver config import.
Adds ConfigServerConfigDataMissingEnvironmentPostProcessor that checks if there is a spring.config.import=configserver: statement. If not, an exception is thrown and a FailureAnalyzer provides hints to fix the issue.

Fixes gh-1813
2021-03-10 16:59:29 -05:00
spencergibb
a95f1300ad Ensures spring.cloud.config.name takes precedence.
spring.cloud.config.name should only default to spring.application.name, not be overridden by it.

Fixes gh-1784
2021-01-08 12:54:46 -05:00
spencergibb
ccb32d23fc Only use spring.cloud.config.profiles if not 'default'.
In ConfigData, the Profiles object takes care of resolving the default profile. So only prefer spring.cloud.config.profiles if it has been set to something other than 'default'.

Fixes gh-1777
2020-12-23 12:49:42 -05:00
spencergibb
f840725c12 Support Retry in spring.config.import=configserver:
Fixes gh-1775
2020-12-22 17:40:32 -05:00
Spencer Gibb
499739f308 Uses BindHandler if registered in bootstrap. (#1773)
* Uses BindHandler if registered in bootstrap.

This allows spring-cloud-context to register a TextEncryptorBindHandler and handle `{cipher}` prefixed properties prior to sending for remote data.

* Adds test that a BindHandler in bootstrap context is used.

* Makes KeyProperties a bean that is conditional on missing.
2020-12-20 11:39:11 -05:00
spencergibb
f5e5753dd5 Prefer client profiles over spring.profiles.active
If spring.clout.config.profile is set use it otherwise use profiles set by spring boot.

Fixes gh-1764
2020-12-14 21:32:53 -05:00
spencergibb
05558e8e9a Merge branch '2.2.x' 2020-11-10 13:31:12 -05:00
Andy Clement
bf2c61f722 Do not discard the root exception when things go wrong
The root exception can detail an important root cause. For
example with native-images it can indicate a flag you need
to set for the native-image to compile correctly:
Caused by: java.net.MalformedURLException:
  Accessing an URL protocol that was not enabled. The URL
  protocol http is supported but not enabled by default.
  It must be enabled by adding the -H:EnableURLProtocols=http
  option to the native-image command.
2020-11-10 13:25:38 -05:00
spencergibb
cb57c25244 Updates field name to resource 2020-10-16 15:02:31 -04:00
spencergibb
8c0c9384f2 Updates ConfigData to use updated api
See gh-1715
2020-10-16 13:23:41 -04:00