Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What if GitHub is down? #24

Open
garethellis36 opened this issue Nov 7, 2018 · 2 comments
Open

What if GitHub is down? #24

garethellis36 opened this issue Nov 7, 2018 · 2 comments
Labels
documentation Documentation issues

Comments

@garethellis36
Copy link

Hello,

If I understand the source code correctly, if GitHub is down or there is some kind of network availability issue, RemoteFetch::remoteFetchBundles() is going to throw a TransferException from Guzzle. Do I have this right? In other words, to properly use this class, we should wrap calls to getLatestBundle() in try/catch and fall back to the Fetch class?

@paragonie-scott
Copy link
Member

paragonie-scott commented Nov 7, 2018

Alternatively, assuming you have a mirror somewhere else:

<?php
use ParagonIE\Certainty\RemoteFetch;
use GuzzleHttp\Exception\TransferException;

try {
    $fetch = new RemoteFetch('/path/to/certainty/data');
    $latestCACertBundle = $fetch->getLatestBundle();
} catch (TransferException $ex) {
    $fetch = new RemoteFetch(
        '/path/to/certainty/data',
        'https://example.com/certainty/data'
    );
    $latestCACertBundle = $fetch->getLatestBundle();
}

@paragonie-scott paragonie-scott added the documentation Documentation issues label Nov 7, 2018
@paragonie-scott
Copy link
Member

Ultimately, falling back to the Fetch class as a last ditch effort if both Github and whatever backup you use are down is a good idea, but if you're having a network availability error, the ensuing HTTPS request will also fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation issues
Projects
None yet
Development

No branches or pull requests

2 participants