A working solution for Viper Issue #315 - Environment variable expansion in configuration files.
While working with gofiber and using viper to load env variables from .env
or .env.*
(depending on environment such as .env.testing when testing), I noticed viper does not handle dynamic env variables properly. A simple googling of this problem showed me that since 2017, developers have needed Viper to support environment variable expansion in .env
files. For example:
QUERY_DB_HOST=${QUERY_DB_HOST:-127.0.0.1}