Files
DistrictCentral/server/CheckEnvironment.js

36 lines
1.3 KiB
JavaScript
Raw Normal View History

console.log("Checking Environment...");
if(!process.env.MONGO_URL) {
console.error("Must provide the MONGO_URL environment variable point to the district central's main database. Should be of the format: `mongodb://localhost:27017/DatabaseName` or `mongodb://user_name:password@host.domain.com,host2.domain.com,host3.domain.com/DatabaseName?replicaSet=set_name`.")
process.exit(0);
}
if(!process.env.MONGO_URL2) {
console.error("Must provide the MONGO_URL2 environment variable pointing to the chromebook data collection dataset. Should be of the format: `mongodb://localhost:27017/DatabaseName` or `mongodb://user_name:password@host.domain.com,host2.domain.com,host3.domain.com/DatabaseName?replicaSet=set_name`.")
process.exit(0);
}
try {
let settings = Assets.getText('settings.json');
}
catch(e) {
console.error("Must have a /private/settings.json file with the following format:");
console.error(`
{
"google": {
"clientId": "xxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
"secret": "xxxxxxxxxxxxxxxxxxx",
"loginStyle": "redirect",
"scope": [
"email",
"https://www.googleapis.com/auth/plus.login",
"https://www.googleapis.com/auth/contacts.readonly"
]
}
}
`);
process.exit(0);
}
console.log("Environment Checking Complete.")