The config object used here is the not the 'application config'. 
It will not contain variables contained in the yaml files. 

A fix will be to import the config into a new variable and use that instead.

* I think the overall idea is good though :)