separating storage from configuration

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2024-08-29 23:37:03 +02:00
parent 7ae4da4d8f
commit db59964c98
2 changed files with 11 additions and 2 deletions

View File

@@ -27,6 +27,14 @@ 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"

View File

@@ -51,7 +51,8 @@ public class Application {
public static void main(String[] args) throws Exception {
var argMap = map(args);
Optional<Path> 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);