配置 - 无效的TOML语法

分享于 

2分钟阅读

ubuntu

 

问题:

我正在尝试使用以下配置文件运行influxDB中继服务:


/# -*- toml -*-



[[http]] 


name = example-http-influxdb 


bind-addr = 0.0.0.0:8086



[[http.output]] 


name = local-influxdb01 


location = http://192.168.1.15:8086/ 


endpoints = {write=/write, write_prom=/api/v1/prom/write, ping=/ping, query=/query} 


timeout = 10s



# EOF



但是我得到了以下错误:

line 1 : invalid TOML syntax


答案1:

试试看


# -*- toml -*-



[[http]]


name = example-http-influxdb 


bind-addr = 0.0.0.0:8086



[[http.output]]


name = local-influxdb01 


location = http://192.168.1.15:8086/ 


endpoints = {write=/write, write_prom=/api/v1/prom/write, ping=/ping, query=/query} 


timeout = 10s



# EOF




答案2:

除了删除两个TOML文件标识符前面的斜杠(在配置文件的开头和结尾)之外,我还需要add double quotation sign 每个值字符串之前和之后(请注意'endpoints '键值),如下所示:


# -*- toml -*-



[[http]]


name ="example-http-influxdb" 


bind-addr ="0.0.0.0:8086"



[[http.output]]


name ="local-influxdb01"


location ="http://192.168.1.15:8086/"


endpoints = {write="/write", write_prom="/api/v1/prom/write", ping="/ping", query="/query"} 


timeout ="10s"



# EOF





syn  
相关文章