<?php

require 'vendor/autoload.php';
use Platformsh\Config;
$conf = PlatformConfig::config();
var_dump($conf["application"]->name);
var_dump($conf["relationships"]->first_db[0]->host);
var_dump($conf["relationships"]->first_db[0]->username);
        return self::$configuration;
    }
    static function read_base64_json($var_name)
    {
        try {
            return json_decode(base64_decode(getenv($var_name)));
        } catch (Exception $e) {
            echo 'Exception : ', $e->getMessage(), " {$var_name} does not seem to exist\n";
            return null;
        }
    }
}
if (getenv('PLATFORM_PROJECT')) {
    try {
        PlatformConfig::set("application", PlatformConfig::read_base64_json('PLATFORM_APPLICATION'));
        PlatformConfig::set("relationships", PlatformConfig::read_base64_json('PLATFORM_RELATIONSHIPS'));
        PlatformConfig::set("variables", PlatformConfig::read_base64_json('PLATFORM_VARIABLES'));
        PlatformConfig::set("app_dir", PlatformConfig::read_base64_json('PLATFORM_APP_DIR'));
        PlatformConfig::set("environment", PlatformConfig::read_base64_json('PLATFORM_ENVIRONMENT'));
        PlatformConfig::set("project", PlatformConfig::read_base64_json('PLATFORM_PROJECT'));
        PlatformConfig::set("application_name", getenv('PLATFORM_APPLICATION_NAME'));
        PlatformConfig::set("app_dir", getenv('PLATFORM_APP_DIR'));
        PlatformConfig::set("environment", getenv('PLATFORM_ENVIRONMENT'));
        PlatformConfig::set("project", getenv('PLATFORM_PROJECT'));
        PlatformConfig::set("port", getenv('PORT'));
    } catch (Exception $e) {
        echo 'Exception : ', $e->getMessage(), " could not decode Platform.sh environment\n";
    }
} else {
    trigger_error("This does not seem to be running on Platform.sh", E_USER_NOTICE);
}