rstudio / config

config package for R
https://rstudio.github.io/config/
256 stars 27 forks source link

Eval only after the configuration was merged. Possible fix for #20 #29

Closed andrie closed 3 years ago

andrie commented 3 years ago

At the moment, all !expr statements in the config file are evaluated, even if these are not relevant for the active configuration. This PR proposes a fix to read the yaml file with eval.expr = FALSE (using a handler) and then evaluates these statements only after the merge is completed. I also add additional test cases (that fail with current code base, but passes with the proposed fix).

This is hopefully a fix for #20

KVInventoR commented 3 years ago

Hi @andrie , @hadley

Is it possible to have a switcher between old and new behaviour? We have something like that:

config::get("APP", config = "default", file = "config.yml")

with next content:

default:
    db2:
        db2Username: !expr credential <- getDB2Creds(); credential$db2Username
        db2Password: !expr credential <- getDB2Creds(); credential$db2Password

which now is broken for us

thanks