bootstrap.js.flow 550 B

12345678910111213141516171819202122232425
  1. // @flow
  2. import Logger from '../Logger';
  3. import {
  4. createGlobalProxyAgent,
  5. } from '../factories';
  6. import type {
  7. ProxyAgentConfigurationInputType,
  8. } from '../types';
  9. const log = Logger.child({
  10. namespace: 'bootstrap',
  11. });
  12. export default (configurationInput?: ProxyAgentConfigurationInputType): boolean => {
  13. if (global.GLOBAL_AGENT) {
  14. log.warn('found global.GLOBAL_AGENT; second attempt to bootstrap global-agent was ignored');
  15. return false;
  16. }
  17. global.GLOBAL_AGENT = createGlobalProxyAgent(configurationInput);
  18. return true;
  19. };