How to use AWS CodeCommit as repository for Spring Cloud Config

爱⌒轻易说出口 提交于 2019-12-24 12:09:13

问题


I am trying to use AWS CodeCommit repository with spring cloud config. I have managed to get it working with SSH. But I would like to use https instead of SSH. AWS suggest to use credential helper. Does anyone know how can I configure spring config cloud to use credential helper? I have looked AWS CodeCommit HTTPS access without setting up credential helper But there is no answer yet and I was wondering if there is some way in spring cloud config to do it.


回答1:


I don't know if you have seen this answer yet, but this explains a little bit and the example with JGit works. AWS CodeCommit HTTPS access without setting up credential helper

Since Spring Cloud Config doesn't yet support adding custom Credential providers you need to implement your own EnvironmentRepository.

For a POC I overrode the JGitEnvironmentRepository, and had to copy almost all the code because what I really needed to override was a private method JGitEnvironmentRepository#setCredentialsProvider. That method is where I used the code from the example I provided above.

Spring Cloud Config uses an auto config to build their MultipleJGitEnvironmentRepository bean and it is annotated with @ConditionalOnMissingBean(EnvironmentRepository.class), so as long as you create a bean of that type you can override their behavior.

So with that said the SSH option is a lot cleaner until Spring expands their support for configuring custom Credential Providers or first class support for CodeCommit.

Open issue for AWS CodeCommit: https://github.com/spring-cloud/spring-cloud-config/issues/334




回答2:


Duplication of a similar question and solution is posted there. AWS CodeCommit HTTPS access without setting up credential helper



来源:https://stackoverflow.com/questions/35206869/how-to-use-aws-codecommit-as-repository-for-spring-cloud-config

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!