在YAML中转义冒号 [英] Escaping colons in YAML

查看:1170
本文介绍了在YAML中转义冒号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何在YAML中转义冒号吗?我yml中的密钥是带有端口号的
域,但是yml文件不适用于此设置:

Does anyone know how to escape colons in YAML? The key in my yml is the domain with port number, but the yml file isn't working with this setup:

###BEGIN
production:
### THIS IS THE ONE I'm HAVING TROUBLE WITH ###
8.11.32.120:8000: GoogleMapsKeyforThisDomain
exampledomain.com: GoogleMapsAPIKeyforThatDomain

development:
 GoogleMapsAPIKeyforDevelopmentDomain
###END

我正在使用一个名为YM4R的Google Maps插件,该插件使用.yml文件存储到
,请根据托管我的应用程序
的位置选择其他Google Maps API密钥...

I'm using a google maps plugin called YM4R that uses a .yml file to select the different Google Maps API key depending on where my app is being hosted...

因此,我试图将 8.11.32.120:8000用作密钥。知道如何做
吗? (如果需要的话,它在gmaps_api_key.yml文件中)

So, I'm trying to make 8.11.32.120:8000 the key. Any idea how to do this? (It's in the gmaps_api_key.yml file if you care)

推荐答案

您需要将引号括起来有麻烦。即:

You'll need to put quotes around the key you're having trouble with. I.e.:

"8.11.32.120:8000": GoogleMapsKeyforThisDomain

这篇关于在YAML中转义冒号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆