Commit 39683c01 authored by Mathieu leclaire's avatar Mathieu leclaire

Add credentials in Mongo

parent 4170d211
......@@ -9,7 +9,7 @@ object Gate extends App {
"""
Settings (
port = 8989,
MongoDB("localhost", 27017, "openmole", "login")
MongoDB(xx,yyy, "localhost", 27017, "openmole", "login")
)"""
case class Config(fileSetttings: Option[File] = None)
......
......@@ -38,7 +38,7 @@ class Servlet(settings: server.Settings) extends ScalatraServlet with Authentica
println(settings.mongoDB.host + " => " + settings.mongoDB.port)
val server = new ServerAddress(settings.mongoDB.host, settings.mongoDB.port)
val credentials = MongoCredential.createCredential("accountUser", "products", "password".toCharArray)
val credentials = MongoCredential.createCredential(settings.mongoDB.user, "admin", settings.mongoDB.password.toCharArray)
val mongoClient = MongoClient(server, List(credentials))
println(settings.mongoDB.db + " ? " + settings.mongoDB.dataSet)
MongoData(mongoClient(settings.mongoDB.db)(settings.mongoDB.dataSet), userSession)
......
......@@ -2,6 +2,8 @@ package server
import javax.script.ScriptEngineManager
import org.openmole.gate.server.Data._
import scala.tools.nsc.interpreter.IMain
object Settings {
......@@ -20,7 +22,7 @@ object Settings {
settings
}
case class MongoDB(host: String, port: Int, db: String, dataSet: String)
case class MongoDB(user: Login, password: Password, host: String, port: Int, db: String, dataSet: String)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment