-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathenvironment.js
129 lines (117 loc) · 4.53 KB
/
environment.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/* eslint-env node */
module.exports = function(environment) {
const authorizationType = 'cookie';
const ENV = {
modulePrefix: 'preprint-service',
appName: 'Preprints',
environment,
rootURL: '/',
locationType: 'auto',
authorizationType,
// sentryDSN: 'http://test@localhost/80' || process.env.sentryDSN,
sentryDSN: null,
sentryOptions: {
release: process.env.GIT_COMMIT,
ignoreErrors: [
// https://github.com/emberjs/ember.js/issues/12505
'TransitionAborted',
],
},
'ember-simple-auth': {
authorizer: `authorizer:osf-${authorizationType}`,
authenticator: `authenticator:osf-${authorizationType}`,
},
// Set to 'local' to use local assets at providerAssetsPath.
providerAssetsURL: process.env.PROVIDER_ASSETS_URL || 'https://staging-cdn.osf.io/preprints-assets/',
// path to local preprint provider assets (relative to public/assets/)
providerAssetsPath: 'osf-assets/files/preprints-assets',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
},
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
},
SHARE: {
baseUrl: process.env.SHARE_BASE_URL || 'https://staging-share.osf.io/',
searchUrl: process.env.SHARE_SEARCH_URL || 'https://staging-share.osf.io/api/v2/search/creativeworks/_search',
},
moment: {
outputFormat: 'YYYY-MM-DD hh:mm a',
},
PREPRINTS: {
defaultProvider: 'osf',
},
i18n: {
defaultLocale: 'en',
},
googleTagManagerId: null,
metricsAdapters: [
{
name: 'GoogleAnalytics',
environments: [process.env.KEEN_ENVIRONMENT || 'production'],
config: {
id: process.env.GOOGLE_ANALYTICS_ID,
setFields: {
// Ensure the IP address of the sender will be anonymized.
anonymizeIp: true,
},
},
dimensions: {
authenticated: 'dimension1',
resource: 'dimension2',
isPublic: 'dimension3',
isWithdrawn: 'dimension4',
version: 'dimension5',
},
},
{
name: 'GoogleTagManager',
environments: process.env.GOOGLE_TAG_MANAGER_ID ? ['all'] : [],
config: {
id: process.env.GOOGLE_TAG_MANAGER_ID,
},
},
],
FB_APP_ID: process.env.FB_APP_ID,
plauditWidgetUrl: 'https://osf-review.plaudit.pub/embed/endorsements.js',
OSF: {
metricsStartDate: '2019-01-01',
},
};
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
ENV.metricsAdapters[0].config.cookieDomain = 'none';
}
if (environment === 'test') {
ENV.APP.autoboot = false;
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
// Don't make external requests during unit test
// TODO: Provide mocks for all components with manual AJAX calls in the future.
ENV.SHARE.baseUrl = '/nowhere';
ENV.SHARE.searchUrl = '/nowhere';
ENV.OSF = {};
ENV.OSF.shareSearchUrl = '/nowhere';
ENV.metricsAdapters[0].config.cookieDomain = 'none';
}
if (environment === 'production') {
ENV.sentryDSN = process.env.SENTRY_DSN || 'https://[email protected]/45';
ENV.ASSET_SUFFIX = process.env.GIT_COMMIT || 'git_commit_env_not_set';
} else {
// Fallback to throwaway defaults if the environment variables are not set
ENV.metricsAdapters[0].config.id = ENV.metricsAdapters[0].config.id || 'UA-84580271-1';
ENV.FB_APP_ID = ENV.FB_APP_ID || '1039002926217080';
}
ENV.APP.LOG_VIEW_LOOKUPS = true;
return ENV;
};