public function load($directory, $subkey = null) {
		$config = [];

		// load main config
		$file = $directory.'_default.php';
		if (!is_file($file)) return array();
		$config = array_merge($config, include($file));

		$file = $directory.'_default_app.php';
		if (is_file($file)) $config = array_merge($config, include($file));

		// overwrite with server specific config
		if (php_sapi_name() === 'cli') {
			$file1 = $directory.gethostname().'.php';
			if (is_file($file1)) $config = array_merge($config, include($file1));
		} else {
			$file1 = $directory.$_SERVER['HTTP_HOST'].'.php';
			$file2 = $directory.(isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR']).'.php'; // On Windows IIS 7 you must use $_SERVER['LOCAL_ADDR'] rather than $_SERVER['SERVER_ADDR'] to get the server's IP address.
			if (is_file($file1)) $config = array_merge($config, include($file1));
			elseif (is_file($file2)) $config = array_merge($config, include($file2));
		}

		foreach ($config as $key => $value) {
			if ($subkey === null) {
				$this->arraySet($this->data, $key, $value);
			} else {
				$this->arraySet($this->data, $subkey . '.' . $key, $value);
			}
		}

		return $this->data;
	}