Escaping colons in YAML

user2071444 picture user2071444 · Feb 14, 2013 · Viewed 18.2k times · Source

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

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...

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)

Answer

Kyri Elia picture Kyri Elia · Feb 14, 2013

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

"8.11.32.120:8000": GoogleMapsKeyforThisDomain