mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Use HTTP Basic Auth if username and password is defined in config
Fixes #5
This commit is contained in:
parent
f973eca818
commit
2738e61597
@ -24,6 +24,7 @@ path | Folder path to game server
|
||||
port | Web port to use
|
||||
host | IP or Hostname to listen on
|
||||
type | Which kind of server to use, can be 'linux', 'windows' or 'wine'
|
||||
auth | If both username and password is set, HTTP Basic Auth will be used
|
||||
|
||||
## How to Use
|
||||
|
||||
|
4
app.js
4
app.js
@ -9,6 +9,10 @@ var app = express();
|
||||
var server = require('http').Server(app);
|
||||
var io = require('socket.io')(server);
|
||||
|
||||
if (config.auth && config.auth.username && config.auth.password) {
|
||||
app.use(express.basicAuth(config.auth.username, config.auth.password));
|
||||
}
|
||||
|
||||
app.use(express.logger('dev'));
|
||||
app.use(express.cookieParser());
|
||||
app.use(express.bodyParser());
|
||||
|
@ -4,4 +4,8 @@ module.exports = {
|
||||
port: 3000,
|
||||
host: '0.0.0.0', // Can be either an IP or a Hostname
|
||||
type: 'linux', // Can be either linux, windows or wine
|
||||
auth: { // If both username and password is set, HTTP Basic Auth will be used
|
||||
username: '', // Username for HTTP Basic Auth
|
||||
password: '', // Password for HTTP Basic Auth
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user