environment.js 2.3 KB

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