1

How to access CloudControl config.free CONFIG_VARS?

conceptdeluxe
  • 3,753
  • 3
  • 25
  • 29

1 Answers1

4

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.

conceptdeluxe
  • 3,753
  • 3
  • 25
  • 29
  • 1
    The relevant documentation site is https://www.cloudcontrol.com/dev-center/Guides/PHP/Add-on%20credentials, but your code is essentially the same. – Stefan Friesel Aug 24 '13 at 21:46
  • Thank you for referencing! Maybe this could be linked in https://www.cloudcontrol.com/dev-center/Add-on%20Documentation/Deployment/Custom%20Config – conceptdeluxe Aug 26 '13 at 15:05