remove leveldb
This commit is contained in:
parent
de17482fdf
commit
653b8ef91a
5 changed files with 622 additions and 142 deletions
|
@ -15,9 +15,6 @@ EXPOSE 80
|
|||
RUN mkdir -p /data/dbs
|
||||
ENV DB_PREFIX /data/dbs/
|
||||
|
||||
RUN mkdir -p /data/sessions
|
||||
ENV SESSION_STORE /data/sessions
|
||||
|
||||
ENV SECRET_DIRNAME /data
|
||||
|
||||
CMD ./Dockerstart.sh
|
|
@ -9,7 +9,6 @@ module.exports = {
|
|||
dbExposePort: Number(process.env.DB_EXPOSE_PORT) || null,
|
||||
proxyServer: process.env.PROXY_SERVER || undefined,
|
||||
secret: process.env.SECRET || require('./secret'),
|
||||
sessionStore: process.env.SESSION_STORE || './sessions',
|
||||
sessionMaxAge: Number(process.env.SESSION_MAX_AGE) || 1000 * 60 * 60 * 24 * 7,
|
||||
siteTitle: process.env.SITE_TITLE || 'Christmas Community',
|
||||
shortTitle: process.env.SHORT_TITLE || 'Christmas',
|
||||
|
|
10
index.js
10
index.js
|
@ -1,5 +1,5 @@
|
|||
global._CC = { require }
|
||||
const expressSessionLevel = require('express-session-level');
|
||||
const PouchSession = require('session-pouchdb-store');
|
||||
const LocalStrategy = require('passport-local').Strategy;
|
||||
const session = require('express-session');
|
||||
const bcrypt = require('bcrypt-nodejs');
|
||||
|
@ -19,7 +19,6 @@ if (!config.dbPrefix.startsWith('http')) {
|
|||
const PouchDB = require('pouchdb').defaults({ prefix: config.dbPrefix });
|
||||
|
||||
const logger = require('./logger');
|
||||
const { dbExposePort } = require('./config');
|
||||
|
||||
const app = express();
|
||||
app.set('base', config.base)
|
||||
|
@ -54,15 +53,12 @@ passport.deserializeUser((user, callback) => {
|
|||
});
|
||||
|
||||
|
||||
const LevelStore = expressSessionLevel(session);
|
||||
const sessionDb = level(config.sessionStore)
|
||||
|
||||
app.use(require('body-parser').urlencoded({ extended: true }));
|
||||
app.use(session({
|
||||
secret: config.secret,
|
||||
resave: false,
|
||||
saveUninitialized: true,
|
||||
store: new LevelStore(sessionDb),
|
||||
store: new PouchSession(new PouchDB('sessions')),
|
||||
cookie: {
|
||||
maxAge: config.sessionMaxAge
|
||||
},
|
||||
|
@ -85,7 +81,7 @@ app.use(config.base, require('./routes')({ db, config }));
|
|||
app.listen(config.port, () => logger.success('express', `Express server started on port ${config.port}!`))
|
||||
|
||||
;(() => {
|
||||
if (!dbExposePort) return
|
||||
if (!config.dbExposePort) return
|
||||
const dbExposeApp = express()
|
||||
dbExposeApp.use('/', require('express-pouchdb')(PouchDB, { inMemoryConfig: true }));
|
||||
dbExposeApp.listen(config.dbExposePort, () => logger.success('db expose', `DB has been exposed on port ${config.dbExposePort}`))
|
||||
|
|
|
@ -24,9 +24,7 @@
|
|||
"express": "4.17.1",
|
||||
"express-pouchdb": "^4.2.0",
|
||||
"express-session": "^1.15.6",
|
||||
"express-session-level": "^1.0.0",
|
||||
"get-product-name": "1",
|
||||
"level": "^6.0.0",
|
||||
"memdown": "^5.1.0",
|
||||
"mkdirp": "^0.5.5",
|
||||
"moment": "^2.29.1",
|
||||
|
@ -35,6 +33,7 @@
|
|||
"passport-local": "^1.0.0",
|
||||
"pouchdb": "^7.2.2",
|
||||
"pug": "^3.0.0",
|
||||
"session-pouchdb-store": "^0.4.1",
|
||||
"u64": "^1.0.1",
|
||||
"yes-no": "^0.0.1"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue