Skip to content

Commit

Permalink
fix: Check for the hslayers-server.db directory existence
Browse files Browse the repository at this point in the history
  • Loading branch information
fzadrazil authored and raitisbe committed Apr 26, 2021
1 parent 0af6e58 commit bd4c117
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -22,4 +22,4 @@ stats.json
.lingua
bundle
*.d.ts
projects/hslayers-server/src/data/hslayers-server.db
projects/hslayers-server/data
2 changes: 1 addition & 1 deletion projects/hslayers-server/.env.example
Expand Up @@ -15,4 +15,4 @@ OAUTH2_CLIENT_ID=id-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
OAUTH2_SECRET=secret-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
OAUTH2_CALLBACK_URL=http://localhost:8087/callback
CORS_WHITELIST=["http://localhost:4200", "https://hub.lesprojekt.cz"]
SUCCESS_REDIRECT_URL=http://localhost:4200
SUCCESS_REDIRECT_URL=http://localhost:4200
10 changes: 10 additions & 0 deletions projects/hslayers-server/server.js
@@ -1,5 +1,15 @@
#!/usr/bin/env node
require('dotenv').config();

const path = require('path');
const fs = require("fs");
if (!process.env.DB_PATH)
process.env.DB_PATH = 'data/hslayers-server.db';
let dbdir = path.dirname(process.env.DB_PATH);
if (!fs.existsSync(dbdir)) {
fs.mkdirSync(dbdir);
}

require('./src/proxy');
require('./src/share');
require('./src/layman');
3 changes: 1 addition & 2 deletions projects/hslayers-server/src/oauth2/session.js
Expand Up @@ -7,8 +7,7 @@ exports.createExpressSession = () => {
const SQLiteStore = connectSQLite3(session);
const session_store = new SQLiteStore({
table: 'sessions',
db: process.env.DB_PATH,
//dir: './data'
db: process.env.DB_PATH
});

const sessionConfig = {
Expand Down

0 comments on commit bd4c117

Please sign in to comment.