Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.env file multiline strings #3607

Closed
sandrodz opened this issue Jun 16, 2016 · 7 comments
Closed

.env file multiline strings #3607

sandrodz opened this issue Jun 16, 2016 · 7 comments

Comments

@sandrodz
Copy link

In docker-compose.yml file I've:

    LETSENCRYPT_HOST: |
          abc.domain.com,
          abe.domain.com,
          aba.domain.com

I'd like to move this to .env file, is this possible?

docs say

Compose expects each line in an env file to be in VAR=VAL format

@shin-
Copy link

shin- commented Jun 21, 2016

Hi,

This is a duplicate of #3527 :)

@shin- shin- closed this as completed Jun 21, 2016
@keithy
Copy link

keithy commented Jan 6, 2019

No it is not a duplicate of 3527.

This is multline support:

COMPOSE_FILE=php.yml:\
mysql.yml

This is support for newlines:
HOST="domain1.com,\ndomain2.com"

@jacobbogers
Copy link

this solved already?

@ghost
Copy link

ghost commented Jun 26, 2019

Hi,
This is still unchanged.
Does anybody know a suitable workaround?, it would be nice to avoid storing e.g. GitLab omnibus configuration directly in docker-compose files, so that the compose configuration could be managed by version control.
Thanks in advance!
PS: @shin- Can you please re-open this issue, because like @keithy mentioned the multiline variable values are something different. I tried to set the GITLAB_OMNIBUS_CONFIG property via a multiline variable manually through a bash script ( using a custom entrypoint ) but unfortunately this was ignored by the GitLab container ( and the solution was quite ugly anyway ).

@keithy
Copy link

keithy commented Jun 26, 2019

I have a script: docker-compose-use <a.env> <b.env>
This script just processes readable a.env and b.env into a single .env file, by removing comments and supporting newlines. It is that simple.

It works really well, and is the basis of my angelbox docker toolkit.

The idea of angelbox is that any docker image can be packaged as a single docker-compose service in which all of the relevant parameters are broken out into environment variables.

Then you provide your configuration as two files, one defining the services that you want composed, the other providing parameters specific to that deployment scenario (i.e. per server). Thus far this works for every scenario that I can envisage.

https://github.com/keithy/sprankle-pod

@efinal
Copy link

efinal commented Aug 13, 2020

according to the document: https://docs.docker.com/compose/compose-file/#environment
you can define envs in compose file like this

environment:
  RACK_ENV: development
  SHOW: 'true'
  SESSION_SECRET: |
      new line 1
      new line 2

@sshishov
Copy link

We want to have multiline variables inside dotenv file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants