kratos: Dotenv files are respected and incorrectly override environment variables

Describe the bug

If I have ENVironment variables and a .env file in root where kratos starts it reads the .env file variable instead of the environment variable.

Reproducing the bug

Steps to reproduce the behavior:

  1. Run export DSN="varFromEnv"
  2. Create .env file with: DSN="varFromFile"
  3. Run ./kratos -c ./kratos.yml migrate sql -e --yes

The value of DSN in Kratos is: varFromFile.

Expected behavior

I think we should read FIRST from Environment variable (if present) because .env file can contain development vars (as in my case).

Environment

  • Version: oryd/kratos:v0.7.6-alpha.1
  • Environment: Docker

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 18 (18 by maintainers)

Most upvoted comments

OK - sorry about that, am trying to clean up old issues, and this one last saw activity in 2021. Thanks for the feedback, reopening!

Ok, but at least the environment variables have priority over those of the config?

Yes! 😃

And using this, does foo come before the bar or the last one wins?

Ha, good question! I don’t know to be honest. My guess would be last one wins!