create-envfile icon indicating copy to clipboard operation
create-envfile copied to clipboard

Sorted keys breaks variable dependence in the envfile

Open danielporto opened this issue 2 years ago • 0 comments

I've observed that the keys on the generated env file are sorted. However it breaks some variables that uses other variables in the env file. For instance: suppose a variable name DOMAIN_NAME=example.com envkey_DOMAIN_NAME: 'example.com' followed by another one such as BAR_HOST_FQDN=bar.${DOMAIN_NAME}. envkey_BAR_HOST_FQDN: "bar.${DOMAIN_NAME}"

the original env file is created such as DOMAIN_NAME=example.com BAR_HOST_FQDN=bar.${DOMAIN_NAME}

But the resulting translated env file is: BAR_HOST_FQDN=bar.${DOMAIN_NAME} DOMAIN_NAME=example.com

However, DOMAIN_NAME is not defined by the time BAR_HOST_FQDN is evaluated resulting in: BAR_HOST_FQDN: bar DOMAIN_NAME: example.com

which is different from the produced in the original env file: BAR_HOST_FQDN: bar.example.com DOMAIN_NAME: example.com

This doesn't seem to be much but it broke several large env files I have.

danielporto avatar Aug 26 '22 15:08 danielporto