add basic auth to server for beta editor setup
This commit is contained in:
parent
63fe883528
commit
bd476d3d38
5 changed files with 659 additions and 388 deletions
|
@ -5,8 +5,6 @@ metadata:
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.global-static-ip-name: "test-web-editor"
|
kubernetes.io/ingress.global-static-ip-name: "test-web-editor"
|
||||||
spec:
|
spec:
|
||||||
tls:
|
|
||||||
- secretName: sslcerts
|
|
||||||
backend:
|
backend:
|
||||||
serviceName: web-editor-node
|
serviceName: web-editor-node
|
||||||
servicePort: 8000
|
servicePort: 8000
|
||||||
|
|
1031
package-lock.json
generated
1031
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -88,6 +88,7 @@
|
||||||
"escape-string-regexp": "^1.0.5",
|
"escape-string-regexp": "^1.0.5",
|
||||||
"eslint-loader": "^1.3.0",
|
"eslint-loader": "^1.3.0",
|
||||||
"express": "^4.13.4",
|
"express": "^4.13.4",
|
||||||
|
"express-basic-auth": "^1.1.5",
|
||||||
"express-session": "^1.13.0",
|
"express-session": "^1.13.0",
|
||||||
"htmlhint": "^0.9.13",
|
"htmlhint": "^0.9.13",
|
||||||
"is-url": "^1.2.2",
|
"is-url": "^1.2.2",
|
||||||
|
|
|
@ -8,6 +8,7 @@ import connectMongo from 'connect-mongo';
|
||||||
import passport from 'passport';
|
import passport from 'passport';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { URL } from 'url';
|
import { URL } from 'url';
|
||||||
|
import basicAuth from 'express-basic-auth';
|
||||||
|
|
||||||
// Webpack Requirements
|
// Webpack Requirements
|
||||||
import webpack from 'webpack';
|
import webpack from 'webpack';
|
||||||
|
@ -32,6 +33,16 @@ import { get404Sketch } from './views/404Page';
|
||||||
const app = new Express();
|
const app = new Express();
|
||||||
const MongoStore = connectMongo(session);
|
const MongoStore = connectMongo(session);
|
||||||
|
|
||||||
|
// For basic auth, in setting up beta editor
|
||||||
|
if (process.env.BASIC_USERNAME && process.env.BASIC_PASSWORD) {
|
||||||
|
app.use(basicAuth({
|
||||||
|
users: {
|
||||||
|
[process.env.BASIC_USERNAME]: process.env.BASIC_PASSWORD
|
||||||
|
},
|
||||||
|
challenge: true
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
const corsOriginsWhitelist = [
|
const corsOriginsWhitelist = [
|
||||||
/p5js\.org$/,
|
/p5js\.org$/,
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue