Use proto schema based on current connection

This commit is contained in:
Mikołaj Pich 2018-07-12 17:37:22 +02:00
parent 4b372876ef
commit 9c0b7b542d
No known key found for this signature in database
GPG key ID: F62B26E36D4C4BAA

7
app.js
View file

@ -4,6 +4,7 @@ const logger = require('morgan');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const sassMiddleware = require('node-sass-middleware');
const protocol = require("./src/utils/connection");
// const favicon = require('serve-favicon');
const subdomain = require('express-subdomain');
@ -35,9 +36,9 @@ app.use(sassMiddleware({
app.use(express.static(path.join(__dirname, 'public')));
app.use((req, res, next) => {
res.locals.uonetplusUrl = "http://" + req.get('host').replace("uonetplus-opiekun", "uonetplus");
res.locals.currentHost = "http://" + req.get('host');
res.locals.mainHost = "http://" + req.get('host')
res.locals.uonetplusUrl = protocol(req) + "://" + req.get('host').replace("uonetplus-opiekun", "uonetplus");
res.locals.currentHost = protocol(req) + "://" + req.get('host');
res.locals.mainHost = protocol(req) + "://" + req.get('host')
.replace(/(api|cufs|uonetplus|uonetplus-opiekun|uonetplus-uzytkownik)\./, "");
next();
});