EnvironmentRepository
's default implementation uses the Git backend, which is handy for managing upgrades and physical environments, as well as auditing changes. To change the location of the repository, you can set the "Spring.cloud.config.server.git.uri" configuration property (for example) in config server application.yml
. If you file:
set up with a prefix, you should work from the local repository so that you can start quickly and easily without a server, but in this case the server will operate directly on the local repository without cloning if it is not bare metal, because the configuration server never changes the remote repository. To extend the config server and make it highly available, you need to point all instances of the server to the same repository, so only the shared file system will work correctly. Even in this case, it is best to use the protocol of the shared file system repository ssh:
so that the server can clone it and use the local working copy as the cache.
The repository implementation maps the parameters of an HTTP resource {label}
to a git tag (commit ID, branch name, or label). If the Git branch or tag name contains a slash ("/"), you should specify the label in the HTTP URL with a special string "(_)" to avoid blurring with other URL paths. For example, if the label is foo/bar
, replacing the slash will cause the label to look like foo(_)bar
. If you use a command-line client like curl (for example, using quotation marks to relay it out of the shell), be careful with the square brackets in the URL.
Placeholders in the Git URI
The Spring Cloud config server supports a git repository URL that contains {application}
and {profile}
(as well {label}
) placeholders, and, if necessary, remember that the tag is applied as a git tag. Therefore, you can easily support the "one repo per application" policy using (for example):
Spring: Cloud: config: server: git: uri:https://github.com/myorg/{ Application}
Or use a similar mode but use {profile}
the "one per profile" policy.
Source source technical support for complete projects 1791743380
Spring Cloud config-git back end