Skip to content

Commit

Permalink
Merge pull request #22 from akumpf/patch-3
Browse files Browse the repository at this point in the history
Enable authentication with smog!
  • Loading branch information
Eric Schoffstall committed Jan 4, 2013
2 parents 32462e2 + 7b9f005 commit 8053321
Showing 1 changed file with 29 additions and 21 deletions.
50 changes: 29 additions & 21 deletions lib/services/admin.coffee
Expand Up @@ -5,26 +5,34 @@ module.exports = (cb, socket) ->
db = cb.socket.mongo.database
admin = db.admin

db.collectionNames (err, r) ->
return cb err.message if err?
out.collections = r
# authenticate against "admin" db first, then go back to original.
if db._dbconn.options.password
dbOrig = db._dbconn.databaseName
db._dbconn.databaseName = "admin"
db.open (err, r) ->
db._dbconn.databaseName = dbOrig
db.open (err, r) ->

admin.serverStatus (err, r) ->
return cb err.message if err?
out.serverStatus = r

admin.buildInfo (err, r) ->
return cb err.message if err?
out.buildInfo = r

admin.profilingLevel (err, r) ->
db.collectionNames (err, r) ->
return cb err.message if err?
out.profilingLevel = r

admin.profilingInfo (err, r) ->
return cb err.message if err?
out.profilingInfo = r

admin.replSetGetStatus (err, r) ->
out.replSetGetStatus = r unless err?
return cb null, out
out.collections = r

admin.serverStatus (err, r) ->
# return cb err.message if err?
out.serverStatus = r unless err?

admin.buildInfo (err, r) ->
# return cb err.message if err?
out.buildInfo = r unless err?

admin.profilingLevel (err, r) ->
# return cb err.message if err?
out.profilingLevel = r unless err?

admin.profilingInfo (err, r) ->
# return cb err.message if err?
out.profilingInfo = r unless err?

admin.replSetGetStatus (err, r) ->
out.replSetGetStatus = r unless err?
return cb null, out

0 comments on commit 8053321

Please sign in to comment.