- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我一直在修补 Spring Cloud Config,但有一个用例,其中配置属性分为两种类型:
开发人员应该能够查看和维护的非 secret 值(例如 JDBC URL 等)
secret 值,只能由具有特殊访问权限(例如密码)的指定人员查看和维护
所以我对“Composite Environment Repositories”的支持非常感兴趣,目前在快照版本中可用。似乎我可以将 Git 用于开发人员管理的属性,将 Vault 用于 secret 属性,并对其进行配置,以便在发生冲突时 Vault 始终优先于 Git。
但是,我发现 Vault 不仅总是优先……它还被用作专用 后端。根本不会返回 Git 的任何属性。
我的 application.yml
看起来像这样:
spring:
profiles:
active: git, vault
cloud:
config:
server:
vault:
order: 1
git:
uri: https://github.com/spring-cloud-samples/config-repo
basedir: target/config
order: 2
我已经像这样向 Vault 写入了一个属性:
vault write secret/foo foo=vault
我这样调用我的配置服务器:
curl -X "GET" "http://127.0.0.1:8888/foo/default" -H "X-Config-Token: a9384085-f048-7c99-ebd7-e607840bc24e"
但是,JSON 响应负载仅包含 Vault 属性。 Git 中没有任何内容:
{
"name": "foo",
"profiles": [
"default"
],
"label": null,
"version": null,
"state": null,
"propertySources": [
{
"name": "vault:foo",
"source": {
"foo": "vault"
}
}
]
}
如果我颠倒 application.yml
中的 order
设置,给予 Git 比 Vault 更高的优先级,这并不重要。只要 Vault 配置文件处于 Activity 状态,它就会充当独占后端。
但是,如果我停用保管库配置文件,则相同的 curl 操作会从 Git 后端返回结果:
{
"name": "foo",
"profiles": [
"default"
],
"label": "master",
"version": "30f5f4a144dba41e23575ebe46369222b7cbc90d",
"state": null,
"propertySources": [
{
"name": "https://github.com/spring-cloud-samples/config-repo/foo.properties",
"source": {
"democonfigclient.message": "hello spring io",
"foo": "from foo props"
}
},
{
"name": "https://github.com/spring-cloud-samples/config-repo/application.yml",
"source": {
"info.description": "Spring Cloud Samples",
"info.url": "https://github.com/spring-cloud-samples",
"eureka.client.serviceUrl.defaultZone": "http://localhost:8761/eureka/",
"foo": "from-default"
}
}
]
}
有什么我可能遗漏的吗? Git 属性和 Vault 属性不……好吧,“复合”在一起的某些原因?
文档中唯一的示例显示了 Git 和 Subversion 一起使用,并且有一个注释警告您所有的存储库都应该包含相同的标签(例如 master
)。我想知道这是否是问题所在,因为 Vault 的标签始终为 null
。
最佳答案
我相信你的依赖关系一定有问题。我还使用 git 和 vault 设置了一个 spring cloud 配置服务器,它工作得很好。我认为强制使用 1.3.0-BUILD.SNAPSHOT 是不够的。 Spring cloud config 1.3.0-BUILD.SNAPSHOT 依赖spring-vault-core。您可能缺少这种依赖性。这可能会导致您在其中一条评论中提到的 bean 创建失败。这是 a link使用 git 和 vault 的示例项目。请随时查看。
关于java - 如何将 Spring Cloud Config 与 Git 和 Vault 复合环境存储库一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42169804/
我目前正在学习保险库。我知道什么是 secret 引擎等以及它是如何工作的。但我没有找到任何关于 vault write 之间差异的信息。和 vault kv put .在我看来,这些命令做同样的事情
我已经在 k8s (AKS) 中安装了 vault 集群,现在我尝试使用 vault CLI 连接到该集群 问题是我找不到任何信息或文档。 我下载了 vault.exe,但是我在哪里配置它以连接到集群
我已经在 k8s (AKS) 中安装了 vault 集群,现在我尝试使用 vault CLI 连接到该集群 问题是我找不到任何信息或文档。 我下载了 vault.exe,但是我在哪里配置它以连接到集群
我在 docker 中运行Vault,如下所示: $ docker run -it --rm -p 8200:8200 vault:0.9.1 我已经打开了金库的密封: $ VAULT_ADDR=
我在 docker 中运行Vault,如下所示: $ docker run -it --rm -p 8200:8200 vault:0.9.1 我已经打开了金库的密封: $ VAULT_ADDR=
有没有办法在 SourceGear Vault Client 中查看已删除文件的内容和历史记录?我找到的唯一方法是取消删除文件,查看文件,然后再次删除文件。 我目前正在使用 Vault 4.1.2。
Vault 代理 v1.4.2 服务在 systemctl 下运行时无法呈现模板和创建文件。 但是相同的模板渲染按预期使用保险库代理服务中使用的命令工作 /opt/vault/bin/vault ag
是否可以列出存储在保险库后端的所有角色?我似乎找不到任何关于如何这样做的引用。 从文档中,似乎可以通过 auth/approle/role/my-role 列出给定角色名称的角色。 ,例如,但我没有看
我已经开始使用 Hashicorp 的 Vault 来管理 secret ,并且对 Vault 的日常密封有一些疑问。我的工作流程有两个身份验证后端;特定用户可以通过写入权限访问 Vault 以添加新
我无法理解 secret 列表的工作原理。我有具有路径权限的策略。 path "sys/mounts/*" { capabilities = ["create", "read", "update",
我们使用带有 Consul 的 Hashicorp Vault 作为存储,我们希望为 Vault 实现强大的备份和恢复策略。 我们特别希望在构建新的 Vault 服务器时备份所有 Vault 数据并使
我正在使用 Hashicorp Vault 和 java springVault,尝试生成几个键值对。执行此操作的最佳方法(或Vault API)是什么?理想情况下,此键值对是在 Vault 内生成的
我正在寻找更好的 secret 轮换解决方案,发现 Vault 动态 secret 是一个很好的解决方案。通过启用 secret 引擎,比如数据库,应用程序/服务可以租用动态 secret 。 我注意
这是official docs关于保管库提供商,事情是: provider "vault" { version = "2.10.0" address = "..." } 我确实设置了 VAUL
在 Docker 容器中运行时,vault -autocomplete-install失败。 $ docker run --privileged -ti vault:latest -autocompl
我只是在尝试新的 Vault UI .我希望能够使用用户名和密码登录。如何从命令行创建新用户以便我可以使用用户名和密码登录? 最佳答案 像这样创建一个新用户: vault write auth/use
我们已经为一台服务器安装并配置了 Hashicorp Vault AppRole 身份验证,通过存储 role_id和 secret_id在服务器上的本地文件中,我们可以让服务器上的代码从文件中读取值
我在本地安装了 Vault。我能够启动本地开发服务器并根据此官方教程 https://learn.hashicorp.com/vault/ 将一些 secret 写入/读取到 Vault kv 中 然
我正在使用 spring-cloud-vault 从 vault 服务器检索版本控制的 kv。当我使用 environemnt.getSecret("key1") 时,它仅返回最新版本的 key ,例
我不知道我是否做错了什么。 但这是我的配置。 // payload.json { "plugin_name": "postgresql-database-plugin", "allowed_r
我是一名优秀的程序员,十分优秀!