MCPcopy Create free account
hub / github.com/github/docs / constructor

Method constructor

lib/hydro.js:48–63  ·  view source on GitHub ↗
({ secret, endpoint, forceDisableMock } = {})

Source from the content-addressed store, hash-verified

46
47export default class Hydro {
48 constructor({ secret, endpoint, forceDisableMock } = {}) {
49 // When mocking, the secret isn't important because nothing's actually
50 // password protected in terms of HTTP authorization. But, the
51 // secret is used for creating an HMAC payload so it has to be
52 // a string.
53 this.secret = secret || process.env.HYDRO_SECRET || (MOCK_HYDRO_POST && '')
54 this.endpoint = endpoint || process.env.HYDRO_ENDPOINT
55 // This class is involved in 2 types of jest tests:
56 // 1. end-to-end tests where jest talks to localhost:4000 (with NODE_ENV===test)
57 // 2. literal unit tests that might mock the socket stuff
58 // Because `MOCK_HYDRO_POST = process.env.NODE_ENV === 'test'` gets set
59 // for either type of jest tests, this additional setting makes it
60 // possible to override `process.env.NODE_ENV === 'test'` from
61 // mocking the HTTP calls.
62 this.forceDisableMock = forceDisableMock
63 }
64
65 /**
66 * Can check if it can actually send to Hydro

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected