Skip to content

dump-env command doesn't respect real Env Vars during Expansion.  #985

@sherifabdlnaby

Description

@sherifabdlnaby

Quoting this comment: #507 (comment)

I just ran into this as well. Given this .env file:

FOO=beans
BAR="cool $FOO"

and then in my env exporting another value for FOO:

export FOO=cats

dumping will use the previous value:

$ composer dump-env -- prod
Successfully dumped .env files in .env.local.php

$ cat .env.local.php
<?php

// This file was generated by running "composer dump-env prod"

return array (
  'FOO' => 'beans',
  'BAR' => 'cool beans',
);

this is obviously not what we'd expect.

Our original use case was splitting a DSN connection into strings so we have

TRANSPORT_EVENT_DSN=amqp://${AMQP_USER:-api}:${AMQP_PASS:-api}@${AMQP_HOST:-rabbitmq}:${AMQP_PORT:-5672}/${AMQP_VHOST:-%2f}

after dumping this now has some default value and we can't use it for configuration anymore...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions