296 Commits

Author SHA1 Message Date
eidottermihi
686064e22e Merge branch 'subversion-support' of https://github.com/eidottermihi/spring-cloud-config into subversion-support
Conflicts:
	spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/JGitEnvironmentRepository.java
2015-02-14 23:28:11 +01: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
8b447dec5a Clarify requirements for client-side encryption
See gh-84
2015-02-13 14:50:56 +00:00
Dave Syer
32bc35b915 Re-order initializers so bootstrap properties can be decrypted
The Environment only picks up the "bootstrap" property source when
the parent context is set, and that was happening at order=0. Moving
it to a higher order than the decryption initializer makes it possible
to decrypt properties in bootstrap.

Fixes gh-84
2015-02-13 09:52:58 +00:00
Dave Syer
e28b137fb0 Clarify how to set basic auth credentials in config
See gh-55
2015-02-12 10:31:02 +00: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
f8d91ef32b Add some Javadocs 2015-02-06 09:52:23 +00:00
eidottermihi
d6f3177bfb Use Spring Cloud code conventions. 2015-02-05 21:46:54 +01:00
Dave Syer
9e35f60d97 Initialize beans after rebinding as necessary
On startup a bean will be bound by the
ConfigurationPropertiesBindingPostProcessor and then initialized
by the ApplicationContext. The ConfigurationPropertiesRebinder
does the binding but not the initialization (until this change).

Fixes gh-80
2015-02-05 14:24:18 +01:00
Dave Syer
a0b9fc6ced Update docs to show encrypt key is mandatory 2015-02-05 10:08:26 +01:00
Dave Syer
79d20a0f74 Fix error message if not failing fast
Fixes gh-78
2015-02-04 11:46:14 +01:00
eidottermihi
fcb6200f90 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-03 18:29:39 +01:00
eidottermihi
55b5b56660 missing svn repo metadata 2015-02-02 23:02:00 +01:00
eidottermihi
6d0b5ce6a2 Add Subversion-backed EnvironmentRepository (SVN operations via SVNKit).
Move SCM independent code to abstract superclass.
2015-02-02 22:58:17 +01:00
Dave Syer
6d3a60b64c Add a call to update log levels during bootstrap
Since the bootstrap customizations are applied in ApplicationContextInitializers
they come too late to affect the logging levels. But the LoggingRebinder listener
isn't installed yet, and the context is not ready for events to be published. So
to get the logging changes in as early as possible we actually need to explicitly
apply them in the property source initializer as soon as the remote properties are
available.

Fixes gh-74, fixes gh-75
2015-01-30 11:44:22 +00:00
Roy Kachouh
2be1962893 Account for different base directories depending on test environment
Fixes gh-62, fixes gh-68
2015-01-29 14:25:25 +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
e5e4cb0348 Change method name from getUri() to getRawUri()
Users would have seen DOWN status in a health indicator whenever
the config server was secure.

Fixes gh-69
2015-01-23 17:39:14 +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
048bc6a9a7 systemPropertiesOverride -> overrideSystemProperties 2015-01-17 15:11:47 +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
1a2c21a081 Move health indicator to main application context 2015-01-16 14:12:59 +00:00
Dave Syer
d8c7cc52fe Be smarter about the ConfigClientProperties and parent context
In case there is a parent context we can re-use the bean from that
if it exists, instead of always creating it and risking the values
being different.
2015-01-16 14:03:12 +00:00
Stefan Djurasic
e2b4bea238 Fixing copy/paste error in BootsrapApplicationListener
... which prevented using an external bootstrap.properties file

Fixes gh-56, fixes gh-59
2015-01-15 16:14:56 +00:00
Dave Syer
3796133980 Use @ConditionalOnProperty where possible 2015-01-15 14:07:45 +00:00
Dave Syer
ecc65dd087 Clarify EnvironmentRepository contract 2015-01-06 09:18:40 +00:00
Dave Syer
2a718a2d40 Suppress compiler warnings 2015-01-02 07:29:48 +00:00
Dave Syer
1a4658dedc Update README 2014-12-26 14:05:08 +00:00
Spencer Gibb
78cc55c97b update version of jgit for zero day fix
fixes gh-52
2014-12-18 15:39:35 -07:00
Dave Syer
6d6ad3dc65 Remove default URI for git repository
Application will fail fast if the URI is not set. It *is* however
still set to the sample repo in the -exec.jar that we distribute.

Fixes gh-51
2014-12-18 17:09:11 +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
fade46210e make ConfigClientProperties required=false
fixes gh-50
2014-12-16 12:55:02 -07:00
Dave Syer
574c4d5097 Really enable cacheing 2014-12-12 11:56:01 +00:00
Dave Syer
0ef78db45c Fix integration test 2014-12-12 11:23:42 +00:00
Dave Syer
aeda3cb3f3 Enable caching in travis 2014-12-12 10:42:18 +00:00
Dave Syer
7a7550735e Change docs path in README 2014-12-11 15:41:36 +00:00
Spencer Gibb
954adc21c2 document failFast option
fixes gh-49
2014-12-05 12:31:16 -07:00
Spencer Gibb
eb48314cea added failFast option
fixes gh-1
2014-12-04 19:38:02 -07:00
Marcin Zajaczkowski
66ab6ca461 Small simplifications in BootstrapApplicationListener
Fixes gh-42
2014-12-04 08:35:40 +00:00
Spencer Gibb
28b27dfac7 add RefreshScopeRefreshedEvent when RefreshScope.refresh*() is called. This is so apps can do something when a POST is received at /refresh even if the environment hasn't changed. 2014-12-03 11:36:47 -07:00
Dave Syer
2caf87f92e Revert some @Ignores after bugfixes in Spring
Also lifts the restriction on @RefreshScope and @Configuration
(since that was imposed by a bug).

Fixes gh-43
2014-12-03 17:19:05 +00:00
Dave Syer
3911d91e57 Remove reflection hack 2014-12-03 15:06:17 +00:00