Skip to content

Document Compose's syntax for variable defaults - #84

Merged
londoncalling merged 2 commits into
docker:vnext-composefrom
nVitius:var-interpolation-docs
Oct 31, 2016
Merged

Document Compose's syntax for variable defaults#84
londoncalling merged 2 commits into
docker:vnext-composefrom
nVitius:var-interpolation-docs

Conversation

@nVitius

Copy link
Copy Markdown
Contributor

This feature was not supported previously, but
was added in docker/compose#3108

@aanand

Copy link
Copy Markdown
Contributor

Thanks! We should document both forms of the inline default syntax:

  • ${VAR-default} (only fall back if VAR is unset)
  • ${VAR:-default} (fall back if VAR is unset or empty)

mdlinville pushed a commit that referenced this pull request Oct 11, 2016
code is bind mounted into the development container. Otherwise in Task 3
changes made to the source code outside the container will not be
visible inside the container.
This is basically the change made by @mbtamuli in #84 but that change
seems to have been abandoned.
Signed-off-by: Dan Liew <daniel.liew@imperial.ac.uk>
@johndmulhausen

Copy link
Copy Markdown
Contributor

Question: Is this for upcoming Docker Compose functionality or is this functionality already released?

@nVitius

Copy link
Copy Markdown
ContributorAuthor

@aanand: thanks, I missed that part.
@johndmulhausen: It looks like it's slated for 1.9.

@mdlinville

Copy link
Copy Markdown

In that case, please rebase this on the branch vnext-compose.

@nVitius
nVitiusforce-pushed the var-interpolation-docs branch from 132b503 to bf39724CompareOctober 12, 2016 16:48
@nVitius
nVitius changed the base branch from master to vnext-composeOctober 12, 2016 16:49
This feature was not supported previously, but
was added in docker/compose#3108
@nVitius
nVitiusforce-pushed the var-interpolation-docs branch from bf39724 to bb7661aCompareOctober 12, 2016 16:50
@nVitius

Copy link
Copy Markdown
ContributorAuthor

Okay, I rebased over the vnext-compose branch and added the comment regarding the different syntax.

@mdlinvillemdlinville left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is looking good. I added a couple of style suggestions which I think may make this easier to understand. Please let me know what you think about these.


Both `$VARIABLE` and `${VARIABLE}` syntax are supported. Extended shell-style
features, such as `${VARIABLE-default}` and `${VARIABLE/foo/bar}`, are not
In the case of environment variables that are not set, it is also possible to

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider "you can" instead of "it is possible to".

Comment threadcompose/compose-file.md Outdated
Both `$VARIABLE` and `${VARIABLE}` syntax are supported. Extended shell-style
features, such as `${VARIABLE-default}` and `${VARIABLE/foo/bar}`, are not
In the case of environment variables that are not set, it is also possible to
define default values like so: `${VARIABLE:-default}`. In this case, Compose

@mdlinvillemdlinvilleOct 12, 2016

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider rewriting this a bit:

...define default values using one of the following syntax variants.

  • To provide a default value which will be used if VARIABLE is unset or empty:

    ${VARIABLE:-default}
    
  • To provide a default value if VARIABLE is empty:

    ${VARIABLE-default}

Both...

Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
@londoncalling

Copy link
Copy Markdown
Contributor

@mstanleyjones can you look at the updates I made here per your comments, and if this looks good, review and approve? Then either you or I can merge this...?

@mdlinville

Copy link
Copy Markdown

LGTM, thought I would still reconsider "it is possible to"...

@londoncalling
londoncalling merged commit 1676a84 into docker:vnext-composeOct 31, 2016
@johndmulhausenjohndmulhausen added this to the compose/1.9.0 milestone Nov 11, 2016
joaofnfernandes pushed a commit to joaofnfernandes/docker.github.io that referenced this pull request Aug 16, 2017
joaofnfernandes pushed a commit to joaofnfernandes/docker.github.io that referenced this pull request Aug 16, 2017
JimGalasyn pushed a commit that referenced this pull request Aug 16, 2017
shin- pushed a commit to shin-/docker.github.io that referenced this pull request Aug 19, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@nVitius@aanand@johndmulhausen@mdlinville@londoncalling