Servicedock: Webgui for Docker Swarm. Manage Docker Swarm a a Service.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 lines
998 B

module.exports = function(app, io, authentication) {
var docker = require('docker.js')(app, io);
// New Authenticated Client
function connection(socket, userdata) {
console.log("=> new connection from "+userdata.username);
docker.connect(socket);
}
// Handle Connection Authentication
require('socketio-auth')(io, {
authenticate: function (socket, data, callback) {
console.log("=> authenticate: ", data.username);
authentication(data.username, data.password,
function(username) {
console.log("user logged in", username);
callback(null, true)
},
function(username, where, err) {
console.log("login failed", username, where, err);
callback(new Error("wrong credentials"))
});
},
postAuthenticate: connection,
timeout: "none"
});
var module = {};
return module;
}