为什么hashicorp金库JSON配置失败“错误初始化监听事件的类型的监听器”?

问题描述 投票:1回答:1

当使用hashicorp vault版本1.0.2和config.json以下JSON配置文件:

{
  "listener": [
    {
      "tcp": [
        {
            "address": "0.0.0.0:8300",
            "tls_disable": 1
        }
      ]
    }
  ],
  "storage": {
    "file": {
      "path": "/tmp/foobar"
    }
  }
}

vault server -config config.json失败,错误初始化监听事件的类型的监听器:监听不明型:“监听器”。

然而,随着config.hcl相同的配置

listener tcp {
   address     = "0.0.0.0:8300"
   tls_disable = 1
}
storage file {
  path = "/tmp/foobar"
}

vault server -config config.hcl按预期工作:

==> Vault server configuration:

                     Cgo: disabled
              Listener 1: tcp (addr: "0.0.0.0:8300", cluster address: "0.0.0.0:8301", max_request_duration: "1m30s", max_request_size: "33554432", tls: "disabled")
               Log Level: (not set)
                   Mlock: supported: true, enabled: true
                 Storage: file
                 Version: Vault v1.0.2
             Version Sha: 37a1dc9c477c1c68c022d2084550f25bf20cac33

==> Vault server started! Log data will stream in below:
...

我在想什么?

hashicorp-vault
1个回答
2
投票

该JSON似乎是正确的,请尝试删除的方括号:

{
  "listener": 
    {
      "tcp":
        {
            "address": "0.0.0.0:8300",
            "tls_disable": 1
        }
    },
  "storage": {
    "file": {
      "path": "/tmp/foobar"
    }
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.