This repository has been archived by the owner on Dec 28, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
config.js
109 lines (105 loc) · 3.33 KB
/
config.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
import 'dotenv/config';
const ivleApi = {
baseUrl: 'https://ivle.nus.edu.sg/api/Lapi.svc/',
key: process.env.IVLE_API_KEY,
token: process.env.IVLE_API_TOKEN,
};
const venuesApi = {
baseUrl: 'http://nuslivinglab.nus.edu.sg/api_dev/api/',
};
const defaults = {
// Set which year of school data to scrape. `null` value will scrape
// a month ahead of the most current school year's data.
year: null,
cachePath: 'cache',
// Maximum cache age in seconds. Can be set to 0 to force refresh every
// time. If set to -1, cached files never expire and are always used.
// By default, force refresh for dist build, cache for one day otherwise.
maxCacheAge: process.env.NODE_ENV === 'production' ? 0 : 86400,
destFolder: 'app/api',
// Pretty-print JSON with '\t', uglify JSON with ''.
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#space_argument
jsonSpace: process.env.NODE_ENV === 'production' ? '' : '\t',
headers: {},
concurrency: 128,
};
export default {
defaults,
bulletinModules: {
cachePath: defaults.cachePath,
maxCacheAge: defaults.maxCacheAge,
destFolder: defaults.destFolder,
jsonSpace: defaults.jsonSpace,
destFileName: 'bulletinModulesRaw.json',
destFacultyDepartments: 'facultyDepartments.json',
ivleApi,
venuesApi,
},
cors: {
cachePath: defaults.cachePath,
maxCacheAge: defaults.maxCacheAge,
destFolder: defaults.destFolder,
jsonSpace: defaults.jsonSpace,
concurrency: defaults.concurrency,
destFileName: 'corsRaw.json',
destLessonTypes: 'lessonTypes.json',
},
corsBiddingStats: {
cachePath: defaults.cachePath,
maxCacheAge: defaults.maxCacheAge,
destFolder: defaults.destFolder,
jsonSpace: defaults.jsonSpace,
destFileName: 'corsBiddingStatsRaw.json',
},
examTimetable: {
cachePath: defaults.cachePath,
maxCacheAge: defaults.maxCacheAge,
destFolder: defaults.destFolder,
jsonSpace: defaults.jsonSpace,
destFileName: 'examTimetableRaw.json',
},
ivle: {
cachePath: defaults.cachePath,
maxCacheAge: defaults.maxCacheAge,
srcFolder: defaults.destFolder,
destFolder: defaults.destFolder,
jsonSpace: defaults.jsonSpace,
concurrency: defaults.concurrency,
destFileName: 'ivleRaw.json',
ivleApi,
},
moduleTimetableDelta: {
cachePath: defaults.cachePath,
maxCacheAge: defaults.maxCacheAge,
destFolder: defaults.destFolder,
jsonSpace: defaults.jsonSpace,
destFileName: 'moduleTimetableDeltaRaw.json',
ivleApi,
},
venues: {
cachePath: defaults.cachePath,
maxCacheAge: defaults.maxCacheAge,
destFolder: defaults.destFolder,
jsonSpace: defaults.jsonSpace,
destFileName: 'venuesRaw.json',
},
consolidate: {
cachePath: defaults.cachePath,
maxCacheAge: defaults.maxCacheAge,
destFolder: defaults.destFolder,
jsonSpace: defaults.jsonSpace,
destFileName: 'modules.json',
destVenues: 'venues.json',
destConsolidated: 'consolidateRaw.json',
},
split: {
destFolder: defaults.destFolder,
jsonSpace: defaults.jsonSpace,
destSubfolder: 'modules',
destModuleCodes: 'moduleCodes.json',
destModuleList: 'moduleList.json',
destModuleInformation: 'moduleInformation.json',
destTimetableInformation: 'timetable.json',
destVenueInformation: 'venueInformation.json',
},
};