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

Fix required env vars ignored except the last one #242

Commits on Aug 31, 2022

  1. Fix required env vars ignored except the last one

    During the variable substitution, if a missing variable was followed
    by an existing one, the empty "outerErr" variable overwrote the previous
    non-empty variable.
    
    Unlike with Docker Compose v1, the first found error did not guarantee
    that an actual error would be thrown.
    
    Example which would have run before the fix even though var1 is not defined:
    
    ```yaml
    services:
      bash:
        image: bash:5.0.18-alpine3.15
        environment:
          var12: "_ ${var1:?Error1} _ ${var2:?Error2} _ "
        command:
          - env
    ```
    
    ```bash
    ```
    
    This change also means that, if multiple variables are missing in one string, the first one will be reported by Docker Compose
    
    Signed-off-by: Ákos Takács <takacs.akos@it-sziget.hu>
    rimelek committed Aug 31, 2022
    Copy the full SHA
    8ce8973 View commit details
    Browse the repository at this point in the history