Commit Graph

43 Commits

Author SHA1 Message Date
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
eidottermihi
3e3638a813 Use Spring Cloud code conventions. 2015-02-14 23:23:08 +01:00
eidottermihi
cbbcab3e62 Removed @Profile for JGitEnvironmentRepository (so it's the default if
no active profile is set). More tests for Subversion Support (based on
Git tests).
2015-02-14 23:21:11 +01:00
eidottermihi
bbd22d0caf missing svn repo metadata 2015-02-14 23:21:10 +01:00
eidottermihi
6112418d42 Add Subversion-backed EnvironmentRepository (SVN operations via SVNKit).
Move SCM independent code to abstract superclass.
2015-02-14 23:21:10 +01:00
Dave Syer
897ad1face Instead of using Map everywhere it's neater to use a strongly typed
object. This reuses JGitEnvironmentRepository, since it shares
most of the same properties. The format of the repos config
changes - now it is a Map not a List and the key is used as a "name"
to provide a default pattern and a location in the basedir.

Example config:

    spring:
      application:
        name: configserver
      cloud:
        config:
          server:
            git:
              uri: https://github.com/spring-cloud-samples/config-repo
              repos:
                iceycake: https://github.com/iceycake/config-repo
                project1:
                  patterns: project1-*,*-project1
                  uri: https://github.com/spring-cloud-samples/config-repo-1
2015-02-12 10:20:16 +00:00
Andy Chan
e05e876f8f Optional support for multiple Git repos
This implementation adds multiple git repositories support to Spring Cloud Config Server.
By giving the following properties file:

info:
  component: Config Server
spring:
  application:
    name: configserver
  jmx:
    default_domain: cloud.config.server
  cloud:
    config:
      server:
        git:
          uri: https://github.com/spring-cloud-samples/config-repo
          repos:
            - patterns: iceycake-*
              uri: https://github.com/iceycake/config-repo
            - patterns: project1-*,*-project1
              uri: https://github.com/spring-cloud-samples/config-repo-1
with uri:

  /{application}/{profile}/{label}

where

spring.cloud.config.server.git.uri is the default git repository
spring.cloud.config.server.repos is a mapping between a git repository and
a string pattern that matches the {application} string in the endpoint.

Fixes gh-82, fixes gh-58
2015-02-10 11:43:28 +00:00
Dave Syer
2d63d598db Add test for spring.cloud.config.server.bootstrap
Setting this flag to "true" makes the config server load its own
configuration from the git repository (hence both have to be
confifgured in bootstrap.yml)
2015-02-10 11:01:26 +00:00
Dave Syer
8c2560b113 Fix YAML endpoints when there are multiple property sources
Also affects properties endpoints. The order of property sources
should be reversed when creating the properties to mimic accurately
the behaviuour of Spring's Environment.

Fixes gh-71
2015-01-28 14:11:20 +00:00
Dave Syer
8c6740ab71 Use only ConfigFileApplicationListener in server mini-application
In the server we use a SpringApplicationEnvironmentRepository to load
the YAML and properties files from git (or locally). It creates a mini
SpringApplication so as to faithfully replicate the way the Environment
is created. Unfortunately that can have side effects on the server
application itself (e.g. setting log levels). In particular if the
mini SpringApplication fails to start then the log levels could be
left in a "preInitialized" state with all log levels OFF by default.

This change ensures that the server logs all errors when loading YAML
and properties files, and also that the client logs the error response
if it is JSON (as it should be).

Fixes gh-66, fixes gh-67
2015-01-21 14:40:39 +00:00
Dave Syer
55f04aaa38 More @Conditionals to prevent error if bootstrap disabled
If user disables bootstrap configuration
(spring.cloud.bootstrap.enabled:false) we have to anticipate some
beans will be missing.

Fixes gh-65
2015-01-19 16:51:53 +00:00
Dave Syer
3d1bc33f8e Don't delete the remote repo if it is also local 2015-01-19 16:11:45 +00:00
Dave Syer
fecc7c8539 Use local file:/... repository in place instead of cloning
Since JGit cannot use the "local" protocol (only git, ssh and https) we can't
use file:/... repositories in the same way as the other protocols. Formerly
we would copy the whole directory and use the copy as a local cache. But then
users are confused when they commit changes to the "remote" and they don't
show up in the server. It seems less confusing to simply use the local
repository as the basedir (although it does mean that ssh: should be used
if you are scaling up the config server).

Fixes gh-63
2015-01-19 15:05:21 +00:00
Dave Syer
a0c9ae3ff0 Allow system property override to be switched off
The default behaviour is the same as before, so a config client
adds the remote property sources "first" (i.e. ahead of system
properties). If the user sets up a  remote config repo with
spring.cloud.config.overrideSystemProperties=false they can
change this behaviour and insert the new property source after
systemEnvironment (i.e. before local config files but after the
other local sources). Of course using an `application.yml` on
the server you can change the default  for all applications.

There is also a new feature in the config server where the operator
can add a map of override properties in
spring.cloud.config.server.overrides.* and have them added with
highest priority in the Environment returned from the server.
Using that the operator can prevent config repositories from
changing the override behaviour by setting
spring.cloud.config.allowOverride=false.

Fixes gh-57
2015-01-16 16:24:41 +00:00
Dave Syer
b29b492817 Add label/ prefix to properties files in the "native" profile
This allows user s to separate their native resources by label, e.g.
/config/master/*.properties, /config/dev/*.properties etc.
2014-12-18 16:49:52 +00:00
Spencer Gibb
eb48314cea added failFast option
fixes gh-1
2014-12-04 19:38:02 -07:00
Dave Syer
66de92b4e2 Close repository after each operation
This prevents the tests failing when they try to delete the
.git files, but there is still a file lock (in Snake YAML),
so does not yet fix gh-45.
2014-12-01 12:20:03 +00:00
Dave Syer
4669102be6 Search in subdirectories of main config repo
... in addition to top level. That way users can
organize their config files, e.g. by subsystem.
Subdirectories have *higher* precedence than the
top level. Users configure which subdirectories to
search through spring.cloud.config.server.git.searchPaths
(array or String, so csv in config file, default empty).

Fixes gh-36
2014-11-17 13:42:04 +00:00
Dave Syer
9d55ef84d0 Extract config server properties to Java bean
ConfigServerProperties is now used to store global properties
for the config server (like the path prefix and bootstrap flag)
under spring.cloud.config.server.* so git specific ones have
been pushed down to spring.cloud.config.server.git.* (similarly
for git->native).

At the same time introduce spring.cloud.config.server.defaultLabel
for the deafult git label (defaults to "master").

Fixes gh-28
2014-11-10 08:46:02 +00:00
Dave Syer
09bdb001d7 Make server tests work offline 2014-10-26 10:42:51 +00:00
Dave Syer
1ece7ab803 Make executable jar work better as an embeddable
I think it's a good idea to provide an executable jar (good
getting started experience), but it wasn't working very well.
The biggest problem was the missing main() method, but that
was easy to fix. More interestingly I have changed the default
config name to "configserver" so "configserver.yml" is loaded
to set the default config for the standalone jar, and this file
can easily be ignored in a customized server.

Fixes gh-17
2014-10-23 05:26:05 -07:00
Dave Syer
5bb361e806 Add .properties and .yml endpoint 2014-10-22 06:27:17 -07:00
Dave Syer
9bd6f11df3 Special treatment for local repository 2014-10-06 11:39:40 +01:00
Dave Syer
ac1743d42c More defensive measures for form-encoded data 2014-09-04 19:29:45 +01:00
Dave Syer
1560d5e301 Add bootstrap support for TextEncryptor
If user provides encrypt.key or encrypt.keyStore.* in bootstrap.yml
the ApplicationContext will now contain a TextEncryptor. This will
also be automatically applied to Environment values that start with
'{cipher}'.
2014-09-04 14:53:41 +01:00
Dave Syer
fdb6d0e354 More defensive about content type 2014-09-02 19:38:00 +01:00
Dave Syer
2e5a1c8ff5 Update package names 2014-08-29 13:34:36 +01:00
Dave Syer
8471d14a18 Rename platform->cloud 2014-08-29 12:52:52 +01:00