environment.js 1.9 KB

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