dayleader / app-yaml-env-compiler

MIT License
21 stars 12 forks source link

Wrong compiling #1

Open IvanDimitrov2002 opened 3 years ago

IvanDimitrov2002 commented 3 years ago

Hello,

I have issue with env variables that are not secrets. For example:

DB_NAME: $DB_NAME
DB_HOST: $DB_HOST
DB_DRIVER: 'mysql'

got compiled to:

DB_NAME: (my secret)
DB_HOST: (my secret)
DB_DRIVER:

In this case DB_DRIVER is not a secret and got wiped out. Is it expected behavior?

pavel-rezabek commented 2 years ago

This is caused by these lines:

  env := strings.Replace(strings.TrimSpace(envVal), "$", "", -1)
  envMap[envName] = os.Getenv(env)

It basically pulls the value from the environment. If it is not there, it overwrites it anyway.

Dirty way to fix this on our side is to have all the parameters in the environment for this action. In your case, add the DB_DRIVER to your environment for the parsing step.

IvanDimitrov2002 commented 2 years ago

Yep, I did exactly that back then :)