Skip to content

Commit

Permalink
[INJIMOB-1599] - update readme and reference for git uri
Browse files Browse the repository at this point in the history
Signed-off-by: Swati Goel <[email protected]>
  • Loading branch information
swatigoel committed Jul 26, 2024
1 parent 12f2337 commit 26895b9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
11 changes: 10 additions & 1 deletion kernel/kernel-config-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ server.servlet.path=/config
```

**Support for multiple config repositories** <br/>
This config server supports multiple repositories to provide configuration. <br/>
How to configure:
1. Set env variable `SPRING_CONFIG_GIT_URIS`
2. The value of this env variable is JSON as string
3. SPRING_CONFIG_GIT_URIS="[{\"uri\": \"<your-git-repository-URL>", \"branch\": \"<folder-in-git-repository-containing-configuration>\"}, {\"uri\": \"<your-git-repository-URL>", \"branch\": \"<folder-in-git-repository-containing-configuration>\"}]"
4. If any property exists in multiple repositories then first repo in the list will have high priority and value will be referred from first repo.


**For Encryption Decryption of properties** <br/>
<br/>
Create keystore with following command: <br/>
Expand All @@ -30,7 +39,7 @@ Now run the jar using the following command: <br/>
`java -jar -Dspring.cloud.config.server.git.uri=< git-repo-ssh-url > -Dspring.cloud.config.server.git.search-paths=< config-folder-location-in-git-repo > -Dencrypt.keyStore.location=file:///< file-location-of-keystore > -Dencrypt.keyStore.password=< keystore-passowrd > -Dencrypt.keyStore.alias=< keystore-alias > -Dencrypt.keyStore.secret=< keystore-secret > < jar-name >`
<br/>
<br/>
To run it inside Docker container provide the follwing run time arguments:
To run it inside Docker container provide the following run time arguments:
1. git_url_env
The URL of your Git repo

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
@Configuration
public class CompositeEnvironmentConfig {

@Value("${my.git.uris}")
private String gitUris;
@Value("${spring.cloud.config.server.git.uri}")
private String cloudConfigGitUris;

@Autowired
private ConfigurableEnvironment configurableEnvironment;
Expand All @@ -35,7 +35,7 @@ public class CompositeEnvironmentConfig {
@Bean
public CompositeEnvironmentRepository compositeEnvironmentRepository() throws JsonProcessingException {
List<EnvironmentRepository> repositories = new ArrayList<>();
GitUri[] configGitUris = objectMapper.readValue(gitUris, GitUri[].class);
GitUri[] configGitUris = objectMapper.readValue(cloudConfigGitUris, GitUri[].class);

for (GitUri gitUri: configGitUris) {
JGitEnvironmentRepository repository = getjGitEnvironmentRepository(gitUri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@ spring:
config:
server:
accept-empty: "false"

git:
uri: ${SPRING_CONFIG_GIT_URIS}

server:
port: 51000
servlet:
path: /config
context-path: ${server.servlet.path}

my:
git:
uris: ${SPRING_CONFIG_GIT_URIS}

health:
config:
enabled: false
Expand Down

0 comments on commit 26895b9

Please sign in to comment.