From 8c85eef4dd56b6a2d4a2563c5634dc2c60a35370 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 18 Apr 2019 21:44:26 +0200 Subject: Finally fixed building from commandline Co-authored-by: LarsVomMars --- src/main/kotlin/App.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/kotlin/App.kt b/src/main/kotlin/App.kt index 37c7f11..3967d80 100644 --- a/src/main/kotlin/App.kt +++ b/src/main/kotlin/App.kt @@ -9,6 +9,8 @@ import io.javalin.rendering.* import io.javalin.rendering.template.TemplateUtil.model import io.javalin.security.* import io.javalin.security.SecurityUtil.roles +import io.javalin.staticfiles.* +import java.io.* import java.util.logging.* const val fileHome = "files" @@ -18,10 +20,13 @@ val fileController = FileController() val log = Logger.getLogger("App.kt") fun main() { - val app = Javalin.create() - .enableStaticFiles("../resources/") - .accessManager { handler, ctx, permittedRoles -> roleManager(handler, ctx, permittedRoles) } - .start(7000) + log.warning(File(".").absolutePath) + + val app = Javalin.create().apply { + enableStaticFiles("${File(".").absolutePath}/src/main/resources/", Location.EXTERNAL) + port(7000) + accessManager { handler, ctx, permittedRoles -> roleManager(handler, ctx, permittedRoles) } + }.start() // Set up templating RockerRuntime.getInstance().isReloading = false -- cgit v1.2.3