aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2019-04-18 21:44:26 +0200
committerMarvin Borner2019-04-18 21:44:26 +0200
commit8c85eef4dd56b6a2d4a2563c5634dc2c60a35370 (patch)
treeae8ff0614099bff2ced0696932318b90ac1c0960
parent663ca2f73d88072f35dc33a6b85a3742a8f62e64 (diff)
Finally fixed building from commandline
Co-authored-by: LarsVomMars <lars@kroenner.eu>
-rw-r--r--build.gradle2
-rw-r--r--src/main/kotlin/App.kt13
2 files changed, 10 insertions, 5 deletions
diff --git a/build.gradle b/build.gradle
index ca7fc76..1cab197 100644
--- a/build.gradle
+++ b/build.gradle
@@ -26,7 +26,7 @@ repositories {
rocker {
main {
- optimize = true
+ optimize = false
templateDir = file('src/main/resources/views')
outputDir = file('src/main/resources/generated-views')
classDir = file('src/main/resources/compiled-views')
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