chore: Add additional env variable checks for self-hosted installations
This commit is contained in:
38
index.js
38
index.js
@ -12,12 +12,32 @@ if (
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.AWS_ACCESS_KEY_ID && !process.env.AWS_REGION) {
|
if (process.env.AWS_ACCESS_KEY_ID) {
|
||||||
console.error(
|
[
|
||||||
'The AWS_REGION env variable must be set when using AWS, e.g (us-east-1)'
|
'AWS_REGION',
|
||||||
);
|
'AWS_SECRET_ACCESS_KEY',
|
||||||
// $FlowFixMe
|
'AWS_S3_UPLOAD_BUCKET_URL',
|
||||||
process.exit(1);
|
'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 ${key} env variable must be set when using the Slack integration`
|
||||||
|
);
|
||||||
|
// $FlowFixMe
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!process.env.URL) {
|
if (!process.env.URL) {
|
||||||
@ -44,6 +64,12 @@ if (!process.env.REDIS_URL) {
|
|||||||
process.exit(1);
|
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') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
console.log('\n\x1b[33m%s\x1b[0m', 'Running Outline in production mode.');
|
console.log('\n\x1b[33m%s\x1b[0m', 'Running Outline in production mode.');
|
||||||
} else if (process.env.NODE_ENV === 'development') {
|
} else if (process.env.NODE_ENV === 'development') {
|
||||||
|
Reference in New Issue
Block a user