From db59964c98b516b807923924f5989fdd4287f714 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Thu, 29 Aug 2024 23:37:03 +0200 Subject: [PATCH] separating storage from configuration Signed-off-by: Stephan Richter --- de.srsoftware.oidc.app/build.gradle | 10 +++++++++- .../main/java/de/srsoftware/oidc/app/Application.java | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/de.srsoftware.oidc.app/build.gradle b/de.srsoftware.oidc.app/build.gradle index 4a23c3b..8007b12 100644 --- a/de.srsoftware.oidc.app/build.gradle +++ b/de.srsoftware.oidc.app/build.gradle @@ -27,11 +27,19 @@ test { useJUnitPlatform() } +task run(type: JavaExec) { + group = "application" + description = "Run the main class with JavaExecTask" + classpath = sourceSets.main.runtimeClasspath + mainClass = 'de.srsoftware.oidc.app.Application' + args = ['--base','/home/srichter/workspace/LightOIDC/de.srsoftware.oidc.web/src/main/resources'] +} + jar { manifest { attributes "Main-Class": "de.srsoftware.oidc.app.Application" } -duplicatesStrategy = DuplicatesStrategy.EXCLUDE + duplicatesStrategy = DuplicatesStrategy.EXCLUDE from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } diff --git a/de.srsoftware.oidc.app/src/main/java/de/srsoftware/oidc/app/Application.java b/de.srsoftware.oidc.app/src/main/java/de/srsoftware/oidc/app/Application.java index 265a6b3..0983157 100644 --- a/de.srsoftware.oidc.app/src/main/java/de/srsoftware/oidc/app/Application.java +++ b/de.srsoftware.oidc.app/src/main/java/de/srsoftware/oidc/app/Application.java @@ -51,7 +51,8 @@ public class Application { public static void main(String[] args) throws Exception { var argMap = map(args); Optional basePath = argMap.get(BASE_PATH) instanceof Path p ? Optional.of(p) : empty(); - var storageFile = (argMap.get(CONFIG_PATH) instanceof Path p ? p : configDir(APP_NAME).resolve("data.json")).toFile(); + var configFile = (argMap.get(CONFIG_PATH) instanceof Path p ? p : configDir(APP_NAME).resolve("config.json")).toFile(); + var storageFile = configDir(APP_NAME).resolve("data.json").toFile(); var keyDir = storageFile.getParentFile().toPath().resolve("keys"); var passwordHasher = new UuidHasher(); var firstHash = passwordHasher.hash(FIRST_USER_PASS, FIRST_UUID);