environment.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. ENV.APP.API_HOST = 'http://localhost:8000';
  40. }
  41. if (environment === 'test') {
  42. // Testem prefers this...
  43. ENV.baseURL = '/';
  44. ENV.locationType = 'none';
  45. // keep test console output quieter
  46. ENV.APP.LOG_ACTIVE_GENERATION = false;
  47. ENV.APP.LOG_VIEW_LOOKUPS = false;
  48. ENV.APP.rootElement = '#ember-testing';
  49. }
  50. if (environment === 'production') {
  51. ENV.locationType = 'trailing-slash';
  52. }
  53. return ENV;
  54. };