environment.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. tickFrequency: 15000,
  34. // Toastings time
  35. toastBaseDisplayTime: 4000,
  36. toastMaxDisplayTime: 9000,
  37. toastLengthFactor: 110,
  38. toastHideAnimationLength: 200
  39. }
  40. };
  41. if (environment === 'development') {
  42. // ENV.APP.LOG_RESOLVER = true;
  43. ENV.APP.LOG_ACTIVE_GENERATION = true;
  44. ENV.APP.LOG_TRANSITIONS = true;
  45. // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
  46. ENV.APP.LOG_VIEW_LOOKUPS = true;
  47. ENV.APP.tickFrequency = 1000;
  48. }
  49. if (environment === 'test') {
  50. // Testem prefers this...
  51. ENV.baseURL = '/';
  52. ENV.locationType = 'none';
  53. // keep test console output quieter
  54. ENV.APP.LOG_ACTIVE_GENERATION = false;
  55. ENV.APP.LOG_VIEW_LOOKUPS = false;
  56. ENV.APP.rootElement = '#ember-testing';
  57. // Maintain api config
  58. ENV.APP.API_HOST = '';
  59. ENV.APP.API_NAMESPACE = 'api';
  60. ENV.APP.API_ADD_TRAILING_SLASHES = true;
  61. // Reduce toast display times for test runner
  62. ENV.APP.toastBaseDisplayTime = 200;
  63. ENV.APP.toastMaxDisplayTime = 200;
  64. ENV.APP.toastLengthFactor = 0;
  65. }
  66. if (environment === 'production') {
  67. ENV.locationType = 'django-location';
  68. }
  69. return ENV;
  70. };