写入时发生保管库错误

写入时发生保管库错误

本文介绍了写入时发生保管库错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想测试Spring Cloud Vault配置.

I wanted to test Spring Cloud Vault configuration.

我在本地安装了Vault服务器,当我尝试write某些键值失败时,要求我使用vault kv put命令.

I installed a Vault server locally and when i try to write some key-values its failing and asking me to use vault kv put command.

在此链接中的示例中

While the example of Spring Cloud Config in this link shows the usage of vault write command

这是我得到的错误

$ vault write secret/my-app foo=bar
Error writing data to secret/my-app: Error making API request.

URL: PUT http://127.0.0.1:8200/v1/secret/my-app
Code: 404. Errors:


WARNING! The following warnings were returned from Vault:

  * Invalid path for a versioned K/V secrets engine. See the API docs for the
  appropriate API endpoints to use. If using the Vault CLI, use 'vault kv put'
  for this operation.

推荐答案

使用以下命令启用单独的路径后,我能够写出

I was able to write after enabling a separate path with the below command

vault secrets enable -path=my-app kv
vault write my-app/my-app password=123

在Spring Cloud Config中,我不得不在bootstrap.yml文件中提及文件夹名称作为后端

In Spring Cloud Config, i had to mention the folder name as backend in bootstrap.yml file

spring:
  cloud:
    vault:
      token: bc53d1a4-2551-4869-9574-7a9e60501ec1
      scheme: http
      generic:
        backend: my-app

这篇关于写入时发生保管库错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!