Commit Graph

59 Commits

Author SHA1 Message Date
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
4ae639c351 Extra docs for embeddable config server
Fixes gh-100
2015-03-11 10:32:02 +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
0c794adf5c Fix concurrent map modification error 2015-02-27 10:27:50 +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
Spencer Gibb
51c53e301e Update return type of environmentRepository @Bean definitions to EnvironmentRepository so @ConditionalOnMissingBean works. 2015-02-16 11:45:56 -07:00
eidottermihi
bc0fc13e28 Fix merge mistake in ConfigServerConfiguration. 2015-02-14 23:31:49 +01:00
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
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
eidottermihi
d6f3177bfb Use Spring Cloud code conventions. 2015-02-05 21:46:54 +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
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
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
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
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
815f9be894 Use entrySet() instead of keySet()
Fixes gh-46
2014-12-01 10:36:02 +00:00
Dave Syer
0af301e7c2 More care with form-encoded data if it might be hex 2014-11-29 12:04:47 +00:00
Dave Syer
208173eccd More granular exception handling to provide better error message 2014-11-29 12:04:25 +00:00
Dave Syer
03d827b432 Break @ConfigurationProperties out to type level 2014-11-17 14:35:52 +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
Tomasz Nurkiewicz
13365f0aae Extracting few methods to improve readability
Fixes gh-27
2014-11-10 14:14:45 +00:00
Dave Syer
91e1ddc9a3 Add fail fast flag for config client if local decryption fails
On the server we choose not to fail if a property cannot be decrypted (clients
might be relying on the other values to be able to deal with the failure).

Fixes gh-31
2014-11-10 09:57:45 +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
4c7cc73671 Add self-bootstrap feature for embedded config server
Also switch to use SpringApplicationEnvironmentRepository
in "native" profile (it's more useful as a "getting started"
tool).

Fixes gh-21, fixes gh-33
2014-11-08 13:12:18 +00:00
Dave Syer
84962cefca Add spring.cloud.config.server.prefix
Fixes gh-23
2014-10-29 15:13:12 +00:00
Dave Syer
09bdb001d7 Make server tests work offline 2014-10-26 10:42:51 +00:00
Joshua Morris
889e62e248 Added the option to use a username and password
Fixes gh-19
2014-10-24 16:49:07 +01:00
Ernesto Hdez
fb17155b7d Avoid ConcurrentModificationException when decrypting
Fixes gh-20
2014-10-24 16:47:05 +01: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
3f05eddc42 Expunge .platform. from config project
Fixes gh-12
2014-10-13 14:16:47 +01:00