private function loadFromLocation($location)
    {
        Logger::get()->debug('Loading settings...');
        // Add the trailing slash to the folder if it is missing.
        if (substr($location, -1) != DIRECTORY_SEPARATOR) {
            $location .= DIRECTORY_SEPARATOR;
        }
        $settingsLocation = $location . 'settings.json';

        if (!is_readable($settingsLocation)) {
            Logger::get()->error(
                'Settings file %s cannot be read.',
                $settingsLocation
            );
            throw new Settings\Exception("Settings file $settingsLocation is unavailable.");
        }

        // Load the settings.
        $settings = json_decode(file_get_contents($settingsLocation), true);
        if (empty($settings)) {
            throw new Settings\Exception('Settings file cannot be parsed.');
        }

        // Load settings customised for the current environment.
        $environmentSettings = null;
        $environment = self::getEnvironment();
        if ($environment) {
            $environmentSettingsLocation = sprintf(
                '%ssettings-%s.json',
                $location,
                strtolower($environment)
            );

            if (is_readable($environmentSettingsLocation)) {
                $environmentSettings = json_decode(file_get_contents($environmentSettingsLocation), true);
                if (!empty($environmentSettings)) {
                    $settings = self::mergeSettings($settings, $environmentSettings);
                }
            }
        }

        $this->settings = self::objectify($settings);

    }