environment.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. // Toastings time
  25. TOAST_BASE_DISPLAY_TIME: 4000,
  26. TOAST_LENGTH_FACTOR: 110,
  27. TOAST_HIDE_ANIMATION_LENGTH: 200
  28. }
  29. };
  30. if (environment === 'development') {
  31. // ENV.APP.LOG_RESOLVER = true;
  32. ENV.APP.LOG_ACTIVE_GENERATION = true;
  33. ENV.APP.LOG_TRANSITIONS = true;
  34. // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
  35. ENV.APP.LOG_VIEW_LOOKUPS = true;
  36. ENV.contentSecurityPolicy = {
  37. 'default-src': "'none'",
  38. 'script-src': "'self' 'unsafe-inline' https://cdn.mxpnl.com http://localhost:8000", // Allow scripts from https://cdn.mxpnl.com and Django runserver
  39. 'font-src': "'self' http://fonts.gstatic.com", // Allow fonts to be loaded from http://fonts.gstatic.com
  40. 'connect-src': "'self' https://api.mixpanel.com http://localhost:8000", // Allow data (ajax/websocket) from api.mixpanel.com, custom-api.local and Django runserver
  41. 'img-src': "'self'",
  42. 'style-src': "'self' 'unsafe-inline' http://fonts.googleapis.com", // Allow inline styles and loaded CSS from http://fonts.googleapis.com
  43. 'media-src': "'self'"
  44. }
  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. }
  66. return ENV;
  67. };