environment.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* jshint node: true */
  2. module.exports = function(environment) {
  3. var ENV = {
  4. modulePrefix: 'misago',
  5. environment: environment,
  6. baseURL: '/',
  7. locationType: 'auto',
  8. EmberENV: {
  9. FEATURES: {
  10. // Here you can enable experimental features on an ember canary build
  11. // e.g. 'with-controller': true
  12. }
  13. },
  14. contentSecurityPolicy: {
  15. 'default-src': "'none'",
  16. 'frame-src': "https://www.google.com/recaptcha/",
  17. 'script-src': "'self' 'unsafe-inline' 'unsafe-eval' https://www.google.com/recaptcha/ https://apis.google.com/ https://www.gstatic.com/recaptcha/ https://cdn.mxpnl.com", // Allow scripts from https://cdn.mxpnl.com
  18. 'font-src': "'self' http://fonts.gstatic.com", // Allow fonts to be loaded from http://fonts.gstatic.com
  19. 'connect-src': "'self' https://api.mixpanel.com", // Allow data (ajax/websocket) from api.mixpanel.com, custom-api.local
  20. 'img-src': "*",
  21. 'style-src': "'self' 'unsafe-inline' http://fonts.googleapis.com", // Allow inline styles and loaded CSS from http://fonts.googleapis.com
  22. 'media-src': "*"
  23. },
  24. APP: {
  25. // Here you can pass flags/options to your application instance
  26. // when it is created
  27. rootElement: '#main',
  28. // Django API
  29. API_HOST: '',
  30. API_NAMESPACE: 'api',
  31. API_ADD_TRAILING_SLASHES: true,
  32. // Misago ticks frequency (in ms, used for refreshing timestamps)
  33. TICK_FREQUENCY: 15000,
  34. // Toastings time
  35. TOAST_BASE_DISPLAY_TIME: 4000,
  36. TOAST_LENGTH_FACTOR: 110,
  37. TOAST_HIDE_ANIMATION_LENGTH: 200
  38. }
  39. };
  40. if (environment === 'development') {
  41. // ENV.APP.LOG_RESOLVER = true;
  42. ENV.APP.LOG_ACTIVE_GENERATION = true;
  43. ENV.APP.LOG_TRANSITIONS = true;
  44. // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
  45. ENV.APP.LOG_VIEW_LOOKUPS = true;
  46. ENV.APP.TICK_FREQUENCY = 1000;
  47. }
  48. if (environment === 'test') {
  49. // Testem prefers this...
  50. ENV.baseURL = '/';
  51. ENV.locationType = 'none';
  52. // keep test console output quieter
  53. ENV.APP.LOG_ACTIVE_GENERATION = false;
  54. ENV.APP.LOG_VIEW_LOOKUPS = false;
  55. ENV.APP.rootElement = '#ember-testing';
  56. // Maintain api config
  57. ENV.APP.API_HOST = '';
  58. ENV.APP.API_NAMESPACE = 'api';
  59. ENV.APP.API_ADD_TRAILING_SLASHES = true;
  60. // Reduce toast display times for test runner
  61. ENV.APP.TOAST_BASE_DISPLAY_TIME = 200;
  62. ENV.APP.TOAST_LENGTH_FACTOR = 0;
  63. }
  64. if (environment === 'production') {
  65. ENV.locationType = 'django-location';
  66. }
  67. return ENV;
  68. };