Commit Graph

77 Commits

Author SHA1 Message Date
Spencer Gibb
828df5262f Add resolvePlaceholders request parameter to EnvironmentController.
Specifically to the `{json|yaml|properties}` endpoints to support sidecar or non-jvm apps to have placeholders resolved automatically.

See https://github.com/spring-cloud/spring-cloud-netflix/issues/877
2016-03-10 11:59:13 -07:00
Dave Syer
82e009b1c2 Add support for comma separated application names in placeholders
Both the SCM and native repositories should now be able to scan
search paths in {application} when application is a comma separated
list.

Fixes gh-338
2016-02-23 17:11:12 +00:00
Dave Syer
b268963025 Let MVC handle content negotiation for endpoints
In particular the ResourceEndpoint is likely to serve data that is
not JSON, so having a "produces" attribute at the type level is a bad
idea.

Fixes gh-337
2016-02-22 14:03:26 +00:00
Dave Syer
8125007700 Add sample app for testing SVN repos manually 2016-02-15 17:05:34 +00:00
Conny Nilimaa
1ca0ba6222 Fix for paths containing spaces. 2016-02-10 10:53:03 -07:00
Dave Syer
2043b05bbe Add placeholder substitution to search paths within SCM repository
E.g. ...searchPaths={application}/ to search the directory with the
same name as the application (in addition to the root).

Fixes gh-328
2016-01-29 10:10:53 +00:00
Matt Benson
2ad51fb93e make tests platform-neutral 2016-01-14 18:00:14 -06:00
Dave Syer
4a35526b97 Locate placeholder in resource search location correctly
Fixes gh-303
2015-12-21 12:16:21 +00:00
Dave Syer
edcb153571 Support for multiple profiles in profile placeholders
In a file-based repository up to now we only support single profiles in
a placeholder. This change adds full support for multiple profiles in
the native profile and slightly limited support for git backends (only
the first profile to match an actual repository will be used to locate
the physical repository, but all profiles will be applied to the search
inside that repository).
2015-12-02 13:18:09 +00:00
Dave Syer
87a1e773a0 Support for placeholders in git and file URIs
The default git repository and also the native one (local files)
now support placeholders for {application}, {profile} and
{label} in the URI (searchLocation for the native repository).

Fixes gh-257
2015-12-02 11:46:30 +00:00
Steve West
d0616a976e Fix bug where prefix keys (e.g. {name: value}) are not stripped
Also removing extraneous post-decrypt stripPrefix which was masking the encrypt bug.

Fixes gh-272
2015-12-01 18:08:55 +00:00
Dave Syer
eb97893b4c Check for escaped labels in binary file paths as well
See gh-264
2015-11-12 16:51:11 +00:00
Dave Syer
c72e3857cd Accept (_) escape for / in environment controller
Fixes gh-264
2015-11-12 15:57:38 +00:00
Dave Syer
75d79fb7f5 Be defensive about null and empty search locations 2015-10-20 09:23:40 -04:00
Dave Syer
c0ddcd800e Add support for binary file server via context negotation
If client sends "Accept: application/octet-stream" then the server
sends back a binary file (no placeholders and no text conversion)
2015-10-06 17:58:07 +01:00
Spencer Gibb
5ceca18292 Add version to environment response
Users see it logged by the config client, and it appears in the
Environment response from the config server. It's hard to add it
to the /env endpoint without some extension points in Boot.

Fixes gh-244, fixes gh-245
2015-10-02 11:40:22 +01:00
Dave Syer
d4ce149f2d Refactor server into packages
Also removes getDefaultLabel() from EnvironmentRepository.
2015-10-01 11:21:17 +01:00
Dave Syer
b024788be9 Factor out encryption into a repository (not controller) 2015-10-01 11:21:17 +01:00
Dave Syer
62846bda84 Add ResourceController for serving plain text config files
Can be adapted to serve content in any format (e.g. nginx config file,
XML configuration for logger, etc.) - basically anything that can be
stored in plain text and doesn't require streaming.

Fixes gh-147, see also gh-198
2015-09-30 15:00:37 +01:00
Dave Syer
25dfa37612 Add support for matching profiles as well as applications
Patterns in the form {application}/{profile} are now supported with
the old behaviour being the default (all profiles matched if none
are specified).

Fixes gh-214
2015-09-25 10:37:34 +01:00
Dave Syer
da2b20c8be Fix test broken by change in commons 2015-09-25 09:43:20 +01:00
Dave Syer
63e90d7d27 Remove extra call to git fetch
A pull is going to happen anyway, so it's probably just
unnecessary overhead.

Fixes gh-227
2015-09-25 09:26:49 +01:00
Dave Syer
33f5cfcdef Line ending changes after gh-221 2015-09-05 10:02:58 +01:00
Dave Syer
ec94a579f4 Synchronize access to code that deletes basedir on startup
When the first request comes in there is a potential race while the
basedir is prepared (if another request comes in at that crucial
time they collide). This change just synchronizes the method where
the basedir is prepared (it's a once only operation).

Fixes gh-187
2015-07-16 09:25:58 +01:00
Dave Syer
0834917275 Support for git labels with slashes ("/")
Spring MVC can't match a pattern with a slash in it so we support
a special character sequence "(_)" which is legal in a URL
but hopefully rare in a git label.

Fixes gh-154
2015-06-24 14:19:13 +01:00
Dave Syer
1504d6cb0c Provide options for key rotation and per-app cryptography
Cipher text (and plain text in the /encrypt endpoint) can now
carry a prefix of {name:value} pairs, all of which are passed
into the TextEncryptorLocator (instead of just the app name
and profiles).

The inputs are prepared symmetrically by the EncryptionController
(if used) and the EnvironmentEncryptor (used in the EnvironmentController).

Tidy up docs and add notes on keys.
2015-06-12 10:15:09 +01:00
Alex Corvino
fdf6689e90 Add option to clone repositories on start
On startup the server will clone all git repositories if the property
"spring.cloud.config.server.git.cloneOnStart" is set to true. If the
property is not set or is set to false then the server will behave
as it does currently.

Fixes gh-149
2015-06-10 09:33:47 +01:00
wojtkiewicz
14726f4964 added few missing tests for new endpoints in EncryptionController 2015-06-08 06:56:04 +01:00
Dave Syer
2a0f73740a Make text encryptor configuration an autoconfig
So that it can be controlled with @ConditionalOnBean etc.
2015-05-26 16:54:57 +01:00
wojtkiewicz
7437cdef49 Introduce TextEncryptorLocator abstraction
Allows more customization of encryption and decryption stack. Should
be no change for existing users.

Fixes gh-124
2015-05-26 15:26:04 +01:00
Dave Syer
891e928890 Extend NoSuchLabelException to SVN repository
See gh-153
2015-05-19 11:58:53 +01:00
Dave Syer
c685931308 Send 404 if Git label not found
See gh-153
2015-05-19 11:49:41 +01:00
Dave Syer
e94b4039a6 Strip "document" prefix from YAML by default
It's pretty uncommon for Spring apps, but sometimes YAML is not a
map, but more naturally a String or Collection. In these cases Spring
puts a "document" prefix in the Map it creates, so we can strip that
off if the user prefers it.

Fixes gh-143
2015-05-19 10:53:51 +01:00
Spencer Gibb
242baae663 add a configurable health indicator for the Config Server
fixes gh-142
2015-05-04 13:32:51 -06:00
Dave Syer
98b64aa4cb If URI has no context path add one ("/")
Fixes gh-131
2015-04-29 11:38:00 +02:00
Dave Syer
280a7a2c09 Allow environment overrides to be escaped for placeholders
E.g. spring.cloud.config.server.overrides.foo=$\{bar} will evaluate
to foo=${bar} in the client's Environment (allowing local replacement
of the placeholder instead of on the configserver).
2015-04-03 10:32:41 +01:00
Roy Clarkson
a15aed0b78 Use 'trunk' as default label for Subversion repositories
This commit adds a getDefaultLabel() method to the EnvironmentRepository
interface. SvnKitEnvironmentRepository returns 'trunk', while all other
implementations return 'master'. ConfigServerMvcConfiguration and
ConfigServerBootstrapConfiguration will utilize labels configured on
the client and server before falling back to the repository's default
label.

Resolves #107
2015-03-24 14:36:52 -05:00
Dave Syer
93543644a2 Nested JSON format instead of flat properties
Since JSON is a subset of YAML it makes more sense to keep the
same format (i.e. nested objects instead of the flattened
property names).

See gh-112
2015-03-24 13:50:36 +00:00
Chris Manning
57bcd734d1 Adding endpoint for .json similar to .yml, .yaml, and .properties
Fixes gh-113, fixes gh-112
2015-03-24 13:25:19 +00:00
Dave Syer
b1ba8df066 Fix native profile so it behaves as described in docs
The SCM repositories have a "clean()" method to strip out the server's
own configuration files from the property sources shipped to remote
clients. The "native" one didn't have that method so this change adds
it with a similar implementation to the SCM case, except slightly
more complicated because of the extra search locations added by the
"label" parameter.

Also changes the name SpringApplicationEnvironmentRepository to
NativeEnvironmentRepository to match the profile and the config properties.

Fixes gh-109
2015-03-20 14:42:42 +00:00
Dave Syer
5a80ce9e3a Explicitly list profiles and label in Environment
Fixes gh-111
2015-03-20 13:13:52 +00:00
Dave Syer
02b13a41b2 Moved non-config client related code into commons
Refresh, Bootstrap and encryption features all moved into commons

See gh-104
2015-03-18 15:41:20 +00:00
Dave Syer
83ef3e4b74 Disable config server client by default in config server
This change adds a listener that inserts a PropertySource really early
so that spring.cloud.config.enabled=false is the default in a config
server. It can be overridden if the user primes the Environment with
spring.cloud.config.enabled=true.

See gh-104
2015-03-17 15:14:32 +00:00
Dave Syer
ee4717bbab Allow patterns in repository search paths
User can now specify spring.cloud.config.server.git.searchPaths as
a list of patterns (instead of a list of subdirectory names).

See gh-97
2015-03-16 11:01:21 +00:00
Dave Syer
5fc2b1af66 Fix @RequestMapping so that git label can contain periods
Spring MVC lops off the "extension" from request paths by default
(causing no end of other problems), but in this case making it
impossible, or unintuitive at best, to use version-like labels
in git repositories (e.g. 1.0.0). This change makes the mapping
a regex match which includes the whole path, not just the stem.

Fixes gh-94
2015-03-02 09:03:59 +00:00
Dave Syer
80cc7f9800 source->environment 2015-02-27 15:52:45 +00:00
Dave Syer
9a8e8e7627 Back to configure->config
The connectors project doesn't use any of the subpackages we do
here so if we movethe Environment and PropertySource into a sub-
package it should be safe.

See gh-91
2015-02-27 15:33:43 +00:00
Dave Syer
1dc13c2964 Tweak test sensitive to ordering 2015-02-27 08:35:00 +00:00
Dave Syer
76871fdf7c Fix YAML output if arrays are nested or contain objects
Fixes gh-92
2015-02-26 18:11:33 +00:00
Dave Syer
105612d30e Config package name change to avoid conflict with connectors
Fixes gh-91
2015-02-25 17:13:00 +00:00