Should I use quotes in environment path names?

前端 未结 3 402
迷失自我
迷失自我 2021-01-30 16:53

I\'m in the process of cleaning up all my config files in an attempt to make them as readable as possible. I\'ve been looking for a style guide on the use of quotes while export

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-30 17:13

    I used these answers above when setting environment path names in a docker .env file, and got bit. I'm putting this here for anyone else looking for how to define environment variables for docker.

    Docker compose reads environment variables from an .env file that exists in the same folder that docker compose is run as stated here https://docs.docker.com/compose/env-file.

    However instead of wrapping the value in quotes, docker compose needs the environment variable defined without quotes, unless the quotes are part of the value. Again, as stated in the url above

    There is no special handling of quotation marks (i.e. they will be part of the VAL, you have been warned ;)

    I was trying to set NODE_PATH=./src for absolute paths to work in a react app being deployed by docker, but had written it as NODE_PATH="./src". This warning pulled me out of 4 hour rabbit hole.

提交回复
热议问题