falti/dotenv-action

Keys being lower-cased

Closed this issue · 4 comments

F21 commented

I noticed that key names are being lower-cased: https://github.com/falti/dotenv-action/blob/master/dotenv_action.js#L16

This is surprising behaviour as variable names are case-sensitive and some applications expect them to be in ALL UPPERCASE.

Perhaps we can introduce an option to not lower-case the keynames, which will be backwards compatible with the current behavior.

Especially with the new option export-variables, it makes sense to preserve the uppercase env variables.

falti commented

I think output variables should be lower-case as this is the common standard for GH actions. I agree it feels odd that we lower the case for the keys when exporting them as environment variables - so maybe we should apply the case change here. In this case we would not need another config parameter. I want to keep this action simple and it starts to become too complex for the little thing it does.

Bottom line:
We should retain the case for the export use case (thanks again for your contribution, @F21 ) but keep the existing behavior as is. It's also documented and nobody so far has seen the lower-casing as an issue.

@falti In my opinion action should only load .env as it is without any transformation. Currently I am facing the issue with your action because keys are lower-cased.

Optionally nice to have flag to control behavior like e.g.:

- name: Load dotenv
  uses: falti/dotenv-action@v1
  with:
    path: .env
    log-variables: true
    export-variables: true
    keys-case: bypass

where bypass is to keep case as it is, lower is lower, upper is upper

PR with this proposal, keeping lower as default behavior: #45

It took me ~30 minutes to figure out why my env variables were not working, turns out they were lower cased. I believe the default value for keys-case should be bypass. I don't understand why the default would be to apply a transformation.