environment.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. // Min time flash is displayed for (in ms)
  25. FLASH_MIN_DISPLAY_TIME: 4500
  26. }
  27. };
  28. if (environment === 'development') {
  29. // ENV.APP.LOG_RESOLVER = true;
  30. ENV.APP.LOG_ACTIVE_GENERATION = true;
  31. ENV.APP.LOG_TRANSITIONS = true;
  32. // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
  33. ENV.APP.LOG_VIEW_LOOKUPS = true;
  34. ENV.contentSecurityPolicy = {
  35. 'default-src': "'none'",
  36. 'script-src': "'self' 'unsafe-inline' https://cdn.mxpnl.com http://localhost:8000", // Allow scripts from https://cdn.mxpnl.com and Django runserver
  37. 'font-src': "'self' http://fonts.gstatic.com", // Allow fonts to be loaded from http://fonts.gstatic.com
  38. 'connect-src': "'self' https://api.mixpanel.com http://localhost:8000", // Allow data (ajax/websocket) from api.mixpanel.com, custom-api.local and Django runserver
  39. 'img-src': "'self'",
  40. 'style-src': "'self' 'unsafe-inline' http://fonts.googleapis.com", // Allow inline styles and loaded CSS from http://fonts.googleapis.com
  41. 'media-src': "'self'"
  42. }
  43. ENV.APP.TICK_FREQUENCY = 1000;
  44. }
  45. if (environment === 'test') {
  46. // Testem prefers this...
  47. ENV.baseURL = '/';
  48. ENV.locationType = 'none';
  49. // keep test console output quieter
  50. ENV.APP.LOG_ACTIVE_GENERATION = false;
  51. ENV.APP.LOG_VIEW_LOOKUPS = false;
  52. ENV.APP.rootElement = '#ember-testing';
  53. ENV.APP.FLASH_MIN_DISPLAY_TIME = 500;
  54. }
  55. if (environment === 'production') {
  56. ENV.locationType = 'django-location';
  57. }
  58. return ENV;
  59. };