environment.js 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. 'script-src': "'self' 'unsafe-inline' 'unsafe-eval' https://cdn.mxpnl.com http://localhost:8000", // Allow scripts from https://cdn.mxpnl.com and Django runserver
  17. 'font-src': "'self' http://fonts.gstatic.com", // Allow fonts to be loaded from http://fonts.gstatic.com
  18. 'connect-src': "'self' https://api.mixpanel.com http://localhost:8000", // Allow data (ajax/websocket) from api.mixpanel.com, custom-api.local and Django runserver
  19. 'img-src': "'self'",
  20. 'style-src': "'self' 'unsafe-inline' http://fonts.googleapis.com", // Allow inline styles and loaded CSS from http://fonts.googleapis.com
  21. 'media-src': "'self'"
  22. },
  23. APP: {
  24. // Here you can pass flags/options to your application instance
  25. // when it is created
  26. rootElement: '#main',
  27. // Django API
  28. API_HOST: '',
  29. API_NAMESPACE: 'api',
  30. API_ADD_TRAILING_SLASHES: true,
  31. // Misago ticks frequency (in ms, used for refreshing timestamps)
  32. TICK_FREQUENCY: 15000,
  33. // Toastings time
  34. TOAST_BASE_DISPLAY_TIME: 4000,
  35. TOAST_LENGTH_FACTOR: 110,
  36. TOAST_HIDE_ANIMATION_LENGTH: 200
  37. }
  38. };
  39. if (environment === 'development') {
  40. // ENV.APP.LOG_RESOLVER = true;
  41. ENV.APP.LOG_ACTIVE_GENERATION = true;
  42. ENV.APP.LOG_TRANSITIONS = true;
  43. // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
  44. ENV.APP.LOG_VIEW_LOOKUPS = true;
  45. ENV.APP.TICK_FREQUENCY = 1000;
  46. }
  47. if (environment === 'test') {
  48. // Testem prefers this...
  49. ENV.baseURL = '/';
  50. ENV.locationType = 'none';
  51. // keep test console output quieter
  52. ENV.APP.LOG_ACTIVE_GENERATION = false;
  53. ENV.APP.LOG_VIEW_LOOKUPS = false;
  54. ENV.APP.rootElement = '#ember-testing';
  55. // Maintain api config
  56. ENV.APP.API_HOST = '';
  57. ENV.APP.API_NAMESPACE = 'api';
  58. ENV.APP.API_ADD_TRAILING_SLASHES = true;
  59. // Reduce toast display times for test runner
  60. ENV.APP.TOAST_BASE_DISPLAY_TIME = 200;
  61. ENV.APP.TOAST_LENGTH_FACTOR = 0;
  62. }
  63. if (environment === 'production') {
  64. ENV.locationType = 'django-location';
  65. ENV.contentSecurityPolicy = {
  66. 'default-src': "'none'",
  67. 'script-src': "'self' 'unsafe-inline' 'unsafe-eval' https://cdn.mxpnl.com", // Allow scripts from https://cdn.mxpnl.com and Django runserver
  68. 'font-src': "'self' http://fonts.gstatic.com", // Allow fonts to be loaded from http://fonts.gstatic.com
  69. 'connect-src': "'self' https://api.mixpanel.com", // Allow data (ajax/websocket) from api.mixpanel.com, custom-api.local and Django runserver
  70. 'img-src': "'self'",
  71. 'style-src': "'self' 'unsafe-inline' http://fonts.googleapis.com", // Allow inline styles and loaded CSS from http://fonts.googleapis.com
  72. 'media-src': "'self'"
  73. };
  74. }
  75. return ENV;
  76. };