In my YML file for Mongo, it fails on the below:
development:
sessions:
default:
database: library
username: lib_user
password: <%= ENV['MONGO_PASSWORD'] %>
hosts:
- <%= ENV['MONGO_HOST'] %>:<%= ENV['MONGO_PORT'] %>
The last line in particular is where the error occurs. The error is below.
Psych::SyntaxError: (<unknown>): did not find expected key while parsing a block mapping at line 26 column 11
If I remove the environment variable for the port, everything works fine. What syntax issue am I missing here?
答案 0 :(得分:0)
该文件中的YAML没有任何问题,尽管我希望在最后一行冒号后面有一个空格(以便hosts
的值是一个键值对的列表,而不是字符串列表。)
<%= ENV['MONGO_HOST'] %>
,MONGO_HOST
会抛出该错误。如果您尝试设置该值,则应加载YAML文件(如果未定义MONGO_PORT
,则可能会抱怨第26行第36行。)