Search code examples
cloudcontrol

How to access CloudControl config.free CONFIG_VARS


How to access CloudControl config.free CONFIG_VARS?


Solution

  • As it is not documented well here comes the answer:

    if ($credFile = getenv('CRED_FILE')) {
        $credFileContents = file_get_contents($credFile);
        if ($credFileContents !== false) {
            $credData = json_decode($credFileContents, true);
            $value = $credData['CONFIG']['CONFIG_VARS']['MY_VAR'];
        }
    }
    

    That means within CRED_FILE the config addon has its corresponding array/secction CONFIG which contains another array/section CONFIG_VARS which then contains your vars.