Commit Graph

149 Commits

Author SHA1 Message Date
Spencer Gibb
121dbefd01 Make {label} placeholder behavior consistent.
Use the default label if the {label} placeholder is in the git uri, but the supplied label is null.

fixes gh-470
2016-08-09 09:12:19 -06:00
Ryan Baxter
1f0bbddc54 Protects from NPE when no data returned from Vault. Fixes #445. 2016-07-19 09:35:59 -04:00
Spencer Gibb
753db0ed22 Implement VaultEnvironmentRepository.
This is an alternative to VCS or file based repository implementations.

All properties are stored ecrypted in vault, regardless of whether or
not that actaully need to be encrypted.

Supports properties style (this.is.a.property) or vault nested
properties.

Adds a watch to client and server, if enabled, the client will long poll
the server and wait for changes rather than relying on a message broker
to send change events.

Adds a server side watch for consul keys, this is useful when vault is
backed by consul (and currently the only use case, since there is not a
consul repository implementation).

Closes gh-397
2016-07-01 11:29:29 -06:00
Matt Benson
c57b5c4e5c using array index properties, e.g. YAML arrays
(at least with a single element), causes the existing array value
to be modified; guard the static array from accidental modification

Fixes gh-422
2016-06-22 09:00:43 +01:00
Dave Syer
c0b148e370 Consult defaultLabel before generating actual config properties
Fixes gh-414
2016-06-11 10:51:02 +01:00
sprgn
eb6ff9840b Added subversion fallback to working copy.
Fallback to working copy of already checkedout repo when/if subversion server becomes unavailable.  Similar functionality alreay exists with git repository.
2016-06-03 14:32:19 -06:00
Daniel Frey
2323878eaa Added override handling of arrays/maps in properties and yaml endpoints
fixes #385
2016-06-01 13:05:46 +01:00
Dave Syer
7430e7deda Make the startup of application context quieter
Every app that requests config from the server starts a mini
application context. We can make it a bit less verbose by
shutting off the startup info logger in the SpringApplication.
2016-06-01 11:41:31 +01:00
Iván Corrales
ba303fd0aa Support for applications with hyphen in name
Formerly the .properties, .json and .yml endpoints did not accept
requests for application names with hyphens. This change makes
hyphens legal in application names, but still illegal in profile
names (you have to pick one).

Fixes gh-384
2016-05-24 09:08:51 +01:00
Dave Syer
984cc5b885 Fix bug in request handling
For some reason path info is always null(?), so the way to get the
resource path is to use request.getRequestURI().
2016-05-03 09:12:25 +01:00
Spencer Gibb
95a7532092 polish 2016-05-02 11:00:12 -06:00
Dave Syer
a121668b92 Simpler handling of request path matching
The residual path can easily be dug out of the request using
substring, so that seems simpler.
2016-04-26 12:31:02 +01:00
Matt Benson
477ee0d42a Allow ResourceController to handle resource paths of arbitrary depth
File paths with slashes seem reasonable, so this change adds support
for those. Unfortunately, but unavoidably this requires some
manipulation of the servlet request, until changes can be made in
Spring MVC. See https://jira.spring.io/browse/SPR-14193.

Fixes gh-376
2016-04-26 12:30:54 +01:00
Dave Syer
be30d54954 Make test whitespace independent (for windoze) 2016-04-19 13:49:22 +01:00
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
f1b4f5c98e Small optimization with duplicate search paths 2016-02-16 10:24:15 +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
Spencer Gibb
05dc6f9ace Force controllers to return json
fixes gh-306
2016-01-15 16:04:06 -07:00
Matt Benson
2ad51fb93e make tests platform-neutral 2016-01-14 18:00:14 -06:00
Dave Syer
25b24e6406 Add some docs for config properties 2015-12-30 15:06:18 +00:00
Michael Wirth
4308bb5eab Close open input streams
Fixes gh-293 fixes gh-315
2015-12-24 15:15:37 +00:00
Dave Syer
3f77d806da Explicitly close all Git objects
It's good manners to do so anyway (and if Git was Closeable we
would have seen compiler warnings). Hopefully means that Windows
users are more happy.
2015-12-22 13:13:23 +00:00
Dave Syer
b553443c70 Use the right cache for placeholder replaced repository locations
Fixes gh-310
2015-12-22 09:18:31 +00:00
Dave Syer
4a35526b97 Locate placeholder in resource search location correctly
Fixes gh-303
2015-12-21 12:16:21 +00:00
Dave Syer
c97a8f5144 Ensure getLocations() is synchronized (just like findOne())
Concurrent access can be an issue with file locks in JGit (e.g.
see gh-261, which no-one reproduced, but smells like it's related).
2015-12-21 10:51:46 +00:00
Dave Syer
9a65a2f1a8 Allow configuration of symmetric key in server outside bootstrap
There's no reason the encrypotor needs to be in the bootstrap context
so we can still support symmetric key encryption via /encrypt
and /decrypt without requiring it to be configured there. With
this change we just look for key properties in the current context
and create an encryptor the same way the bootstrap listener does
in spring-cloud-commons.
2015-12-18 10:17:52 +00:00
Dave Syer
3951569aa2 Allow ciphers in overrides via escape of '{' 2015-12-18 10:15:20 +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
15b5ca804e Remove executable jar from distribution
It doesn't get used much and it has way too many optional dependencies
in it now.
2015-11-05 07:13:31 +01:00
Dave Syer
572522f645 Class name change in Spring Boot 2015-11-02 15:05:50 +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
4310cc2017 Fix test 2015-09-30 17:53:30 +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
02a9eb3cd7 Refactor base classes for EnvironmentRepository implementations
Allows us to re-use the Scm features independent of the repository
abstraction.
2015-09-29 17:08:04 +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
8d8e07a78e Push events for config changes
Works from local repos or with explicit POST to /monitor with
path=<serviceId>, also supports webhooks from github and gitlab.
2015-09-22 17:33:42 +01:00