Skip to content

mw stack deploy does not support JSON arrays in .env file #1589

@AdFisch

Description

@AdFisch

Describe the bug A clear and concise description of what the bug is.

When using JSON arrays in an .env file, the Mittwald parser seems to remove all quotes and thus breaks them. Various workarounds like escaping the quotes (") or placing the array in a single quoted string ('"') did not work.

Detailed example:

When configurating n8n, NODES_EXCLUDE should be used to remove potentially harmful nodes that are not required in the instance. I use a docker-compose.yml for my n8n stack across instances and a prod.env file to customize each instance (e. g. different secrets). Thus, NODES_EXCLUDE must be set in prod.env and contain a valid JSON array with the nodes to be excluded:

docker-compose.yml:

` n8n-main:
image: n8nio/n8n:stable
restart: unless-stopped
depends_on:
postgresql

    environment:
        NODES_EXCLUDE: "${N8N_NODES_EXCLUDE}" # also tried without quotes here
    
    ...`

prod.env:

N8N_NODES_EXCLUDE=["n8n-nodes-base.executeCommand","n8n-nodes-base.localFileTrigger","n8n-nodes-base.readBinaryFile","n8n-nodes-base.readBinaryFiles","n8n-nodes-base.writeBinaryFile","n8n-nodes-base.readWriteFile","n8n-nodes-base.moveBinaryData","n8n-nodes-base.e2eTest"]
(also tried with escaped quotes and single-enquoted strings)

The Mittwald .env parser seems to remove all quotes resulting in the following ENV value in mStudio (which is no valid JSON and, thus, does not work:

NODES_EXCLUDE=[n8n-nodes-base.executeCommand,n8n-nodes-base.localFileTrigger,n8n-nodes-base.readBinaryFile,n8n-nodes-base.readBinaryFiles,n8n-nodes-base.writeBinaryFile,n8n-nodes-base.readWriteFile,n8n-nodes-base.moveBinaryData,n8n-nodes-base.e2eTest]

To Reproduce Steps to reproduce the behavior:

  1. Use a JSON array in your .env file, e. g. the one above.
  2. Reference the variable from the .env file in your docker-compose file, e. g. like shown above
  3. Deploy the stack using "mw stack deploy --env-file=prod.env"
  4. Check resulting .env value in mStudio.

Expected behavior A clear and concise description of what you expected to
happen.

There should be some way to use quotes in .env file (and thus making JSON arrays available), e. g. when escaping them etc.

Environment (please complete the following information):

  • OS: WSL Ubuntu
  • Shell: WSL bash in Windows PowerShell
  • Version (output of mw --version): @mittwald/cli/1.12.0 wsl-x64 node-v20.19.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions