chore: Add additional env variable checks for self-hosted installations

This commit is contained in:
Tom Moor
2019-08-24 10:19:21 -07:00
parent b6dd55fbea
commit d066468bc0

View File

@ -12,12 +12,32 @@ if (
process.exit(1);
}
if (process.env.AWS_ACCESS_KEY_ID && !process.env.AWS_REGION) {
if (process.env.AWS_ACCESS_KEY_ID) {
[
'AWS_REGION',
'AWS_SECRET_ACCESS_KEY',
'AWS_S3_UPLOAD_BUCKET_URL',
'AWS_S3_UPLOAD_BUCKET_NAME',
'AWS_S3_UPLOAD_MAX_SIZE',
].forEach(key => {
if (!process.env[key]) {
console.error(`The ${key} env variable must be set when using AWS`);
// $FlowFixMe
process.exit(1);
}
});
}
if (process.env.SLACK_KEY) {
['SLACK_SECRET', 'SLACK_VERIFICATION_TOKEN', 'SLACK_APP_ID'].forEach(key => {
if (!process.env[key]) {
console.error(
'The AWS_REGION env variable must be set when using AWS, e.g (us-east-1)'
`The ${key} env variable must be set when using the Slack integration`
);
// $FlowFixMe
process.exit(1);
}
});
}
if (!process.env.URL) {
@ -44,6 +64,12 @@ if (!process.env.REDIS_URL) {
process.exit(1);
}
if (!process.env.WEBSOCKETS_ENABLED) {
console.log(
'WARNING: Websockets are disabled. Set WEBSOCKETS_ENABLED env variable to true to enable'
);
}
if (process.env.NODE_ENV === 'production') {
console.log('\n\x1b[33m%s\x1b[0m', 'Running Outline in production mode.');
} else if (process.env.NODE_ENV === 'development') {