forked from maiora/backend-api
Compare commits
No commits in common. "57597c3d9460e25b4af00f8ac77fa4b53eb7c523" and "28a9ec86af188a6fe89dd7c2f008bfc34ac9a091" have entirely different histories.
57597c3d94
...
28a9ec86af
@ -13,22 +13,20 @@ import java.io.FileInputStream
|
||||
import java.util.*
|
||||
|
||||
fun main() {
|
||||
val properties = loadConfig()
|
||||
val port = properties.getProperty("server.port").toInt()
|
||||
embeddedServer(Netty, port = port, host = "0.0.0.0") {
|
||||
module(properties)
|
||||
}.start(wait = true)
|
||||
embeddedServer(Netty, port = 8098, host = "0.0.0.0", module = Application::module)
|
||||
.start(wait = true)
|
||||
}
|
||||
|
||||
fun Application.module(configFile: Properties) {
|
||||
fun Application.module() {
|
||||
val config = ApplicationConfig("application.conf")
|
||||
val configFile = loadConfig()
|
||||
val dbUrl = configFile.getProperty("ktor.database.url")
|
||||
val username = configFile.getProperty("ktor.database.username")
|
||||
val password = configFile.getProperty("ktor.database.password")
|
||||
val secret = config.property("ktor.jwt.secret").getString()
|
||||
configureDatabases(dbUrl, username, password)
|
||||
configureSecurity(secret)
|
||||
configureRouting()
|
||||
configureRouting(dbUrl, username, password)
|
||||
configureSerialization()
|
||||
|
||||
install(CallLogging)
|
||||
@ -47,7 +45,7 @@ fun Application.module(configFile: Properties) {
|
||||
|
||||
fun loadConfig(): Properties {
|
||||
val properties = Properties()
|
||||
val inputStream = FileInputStream("/home/backend_api/config.properties")
|
||||
val inputStream = FileInputStream("/home/ristocloudadm/config.properties")
|
||||
properties.load(inputStream)
|
||||
return properties
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
package eu.maiora.plugins
|
||||
|
||||
//import eu.maiora.model.LogScriptRepositoryImpl
|
||||
//import eu.maiora.routes.analizzaURLRoute
|
||||
//import eu.maiora.routes.eseguiScriptSQLRoute
|
||||
//import eu.maiora.routes.logScriptRouting
|
||||
import eu.maiora.model.AccountsRepositoryImpl
|
||||
import eu.maiora.model.MovimentiRepositoryImpl
|
||||
import eu.maiora.model.ParametriRepositoryImpl
|
||||
@ -11,7 +15,8 @@ import io.ktor.server.application.*
|
||||
import io.ktor.server.response.*
|
||||
import io.ktor.server.routing.*
|
||||
|
||||
fun Application.configureRouting() {
|
||||
//fun Application.configureRouting(dbUrl : String, username : String, password : String, repository : LogScriptRepositoryImpl ) {
|
||||
fun Application.configureRouting(dbUrl : String, username : String, password : String) {
|
||||
routing {
|
||||
get("/") {
|
||||
call.respondText("Hello World!")
|
||||
|
@ -16,7 +16,7 @@ import java.util.*
|
||||
|
||||
|
||||
fun Route.auth(accountsRepository: AccountsRepositoryImpl) {
|
||||
route("/api/auth") {
|
||||
route("/auth") {
|
||||
post() {
|
||||
// Riceve il body della richiesta e lo deserializza in ReceivedResponse
|
||||
val receivedResponse = try {
|
||||
|
Loading…
Reference in New Issue
Block a user