1
0
Fork 0
mirror of https://github.com/seejohnrun/haste-server.git synced 2024-11-01 03:21:21 +00:00

Fix multiple document loading

Closes #32
This commit is contained in:
John Crepezzi 2012-08-13 11:33:20 -04:00
parent 962976c204
commit e0610bc1be
2 changed files with 13 additions and 15 deletions

View file

@ -60,21 +60,19 @@ if (config.recompressStaticAssets) {
} }
// Send the static documents into the preferred store, skipping expirations // Send the static documents into the preferred store, skipping expirations
var path, data;
for (var name in config.documents) { for (var name in config.documents) {
var path = config.documents[name]; path = config.documents[name];
fs.readFile(path, 'utf8', function(err, data) { data = fs.readFileSync(path, 'utf8');
if (data && !err) { winston.info('loading static document', { name: name, path: path });
if (data) {
preferredStore.set(name, data, function(cb) { preferredStore.set(name, data, function(cb) {
winston.info('loaded static document', { name: name, path: path }); winston.debug('loaded static document', { success: cb });
}, true); }, true);
} }
else { else {
winston.warn( winston.warn('failed to load static document', { name: name, path: path });
'failed to load static document',
{ name: name, path: path }
);
} }
});
} }
// Pick up a key generator // Pick up a key generator

File diff suppressed because one or more lines are too long