public function setup( $repository_name = null ) {
		if ( empty( $this->config['repositories'] ) ) {
			Log::instance()->write( 'No repositories in configuration.', 1 );

			return false;
		}

		if ( empty( $repository_name ) ) {
			$repository_name = $this->getDefault();
		}

		if ( ! empty( $this->repositories[ $repository_name ] ) ) {
			return $this->repositories[ $repository_name ];
		}

		if ( empty( $this->config['repositories'][ $repository_name ] ) ) {
			Log::instance()->write( 'Repository not in configuration.', 1 );

			return false;
		}

		$repo_config = $this->config['repositories'][ $repository_name ];

		$repository = new Repository( $repository_name, $repo_config['access_key_id'], $repo_config['secret_access_key'], $repo_config['region'] );

		$this->repositories[ $repository_name ] = $repository;

		Log::instance()->write( 'Setup repository: ' . $repository_name );

		return $repository;
	}