Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

createProxyController.js.flow 882B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // @flow
  2. import Logger from '../Logger';
  3. type ProxyControllerType = {|
  4. HTTP_PROXY: string | null,
  5. HTTPS_PROXY: string | null,
  6. NO_PROXY: string | null,
  7. |};
  8. const log = Logger.child({
  9. namespace: 'createProxyController',
  10. });
  11. const KNOWN_PROPERTY_NAMES = [
  12. 'HTTP_PROXY',
  13. 'HTTPS_PROXY',
  14. 'NO_PROXY',
  15. ];
  16. export default (): ProxyControllerType => {
  17. // eslint-disable-next-line fp/no-proxy
  18. return new Proxy({
  19. HTTP_PROXY: null,
  20. HTTPS_PROXY: null,
  21. NO_PROXY: null,
  22. }, {
  23. set: (subject, name, value) => {
  24. if (!KNOWN_PROPERTY_NAMES.includes(name)) {
  25. throw new Error('Cannot set an unmapped property "' + name + '".');
  26. }
  27. subject[name] = value;
  28. log.info({
  29. change: {
  30. name,
  31. value,
  32. },
  33. newConfiguration: subject,
  34. }, 'configuration changed');
  35. return true;
  36. },
  37. });
  38. };