#Escape quotes in yml

13 messages · Page 1 of 1 (latest)

rocky jay

Not directly related to Discord.js but im using it for a bot and I cant find any better place to ask
So I have a .env file which contains the value

TMP_IDS='{"30059578": {"FirstName": "Joe","LastName": "Blogs"}, "30061640": {"FirstName": "Billy","LastName": "Boy"}}'

this works fine in my env (its a temporary system until the other part is made)

But to deploy it im using docker-compose and I cant seem to for the life of me get it to accept that string, its to do with the quotes but i cant seem to escape characters or anything in yml, anyone got any ideas how I can put that string version of a json object into a yml list value

echo field

i dont know much about it but cant you store environment variables in a .yml file (and .gitignore them)?

rocky jay

So im using docker-compose on my server, so the code is pushed to a github, a build system (teamcity) picks it up and builds the image and pushes it to my registry, portainer then picks up the image has changed and restarts the container, so its all deployed using a docker-compose file so that wont work

It needs to be store in a yml list format

eg:

environment:
      - TOKEN=xxx
      - CLIENT_ID=x
      - GUILD_ID=1xxxx
      - CONTACT_CHANNEL_ID=xxx
      - MEMBER_ROLE_ID=xxxx
      - SOCIETY_NAME='ting'
      - SOCIETY_LINK='a url'
      - TMP_IDS='{"30059578": {"FirstName": "Joe","LastName": "Blogs"}, "30061640": {"FirstName": "Billy","LastName": "Boy"}}'

but that last value isnt valid because of the quotes

echo field

do all env things need to be a string

or does it accept objects/arrays

rocky jay

Only strings

this is just a temporary solution to put some values in while we develop it, once another system is done It will get this object from an API

but thats not written yet

I think i got it via some mad scientist level of \'s

\ before every ", : or space

old solar

you can use ```yml
environment:
- TOKEN=xxx
- CLIENT_ID=x
- GUILD_ID=1xxxx
- CONTACT_CHANNEL_ID=xxx
- MEMBER_ROLE_ID=xxxx
- SOCIETY_NAME='ting'
- SOCIETY_LINK='a url'
- |
TMP_IDS='{"30059578": {"FirstName": "Joe","LastName": "Blogs"}, "30061640": {"FirstName": "Billy","LastName": "Boy"}}'