pull/329/merge
Jonathan Tsai 2020-12-28 18:31:37 -08:00 committed by GitHub
commit 0f2f4a6946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.env
npm-debug.log
node_modules
*.swp

View File

@ -32,6 +32,8 @@
}
},
"useDotenv": true,
"storage": {
"type": "file"
},

View File

@ -19,6 +19,7 @@
"connect-ratelimit": "0.0.7",
"connect-route": "0.1.5",
"pg": "^8.0.0",
"dotenv": "^8.2.0",
"redis": "0.8.1",
"redis-url": "0.1.0",
"st": "^2.0.0",

View File

@ -16,6 +16,10 @@ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
config.port = process.env.PORT || config.port || 7777;
config.host = process.env.HOST || config.host || 'localhost';
if (config.useDotenv) {
require('dotenv').config();
}
// Set up the logger
if (config.logging) {
try {
@ -44,6 +48,10 @@ if (!config.storage.type) {
var Store, preferredStore;
if (config.useDotenv) {
config.storage.password = process.env.STORAGE_PASSWORD;
}
if (process.env.REDISTOGO_URL && config.storage.type === 'redis') {
var redisClient = require('redis-url').connect(process.env.REDISTOGO_URL);
Store = require('./lib/document_stores/redis');