为什么hashicorp vault json配置失败并显示“类型为侦听器的初始化侦听器错误”?

时间:2019-01-29 10:53:32

标签: hashicorp-vault

在使用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失败,并出现初始化类型为listener的监听器出错:未知的监听器类型:“ listener”

但是,在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:
...

我想念什么?

1 个答案:

答案 0 :(得分:1)

JSON似乎是正确的,请尝试删除方形刹车片:

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