Browse Source

minor code improvements

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
sqlite
Stephan Richter 3 months ago
parent
commit
0b2ddd99c0
  1. 8
      de.srsoftware.oidc.app/src/main/java/de/srsoftware/oidc/app/Application.java

8
de.srsoftware.oidc.app/src/main/java/de/srsoftware/oidc/app/Application.java

@ -53,7 +53,9 @@ public class Application {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
var argMap = map(args); var argMap = map(args);
Optional<Path> basePath = argMap.get(BASE_PATH) instanceof Path p ? Optional.of(p) : empty(); Optional<Path> basePath = argMap.get(BASE_PATH) instanceof Path p ? Optional.of(p) : empty();
var configFile = (argMap.get(CONFIG_PATH) instanceof Path p ? p : configDir(APP_NAME).resolve("config.json")).toFile(); var configDir = configDir(APP_NAME);
var defaultFile = configDir.resolve("data.json");
var configFile = (argMap.get(CONFIG_PATH) instanceof Path p ? p : configDir.resolve("config.json")).toFile();
var config = new Configuration(configFile); var config = new Configuration(configFile);
var passHasher = new UuidHasher(); var passHasher = new UuidHasher();
var firstHash = passHasher.hash(FIRST_USER_PASS, FIRST_UUID); var firstHash = passHasher.hash(FIRST_USER_PASS, FIRST_UUID);
@ -61,12 +63,10 @@ public class Application {
FileStoreProvider fileStoreProvider = new FileStoreProvider(passHasher); FileStoreProvider fileStoreProvider = new FileStoreProvider(passHasher);
var defaultConfigDir = configDir(APP_NAME);
var defaultFile = defaultConfigDir.resolve("data.json");
var userService = setupUserService(config, defaultFile, fileStoreProvider).init(firstUser); var userService = setupUserService(config, defaultFile, fileStoreProvider).init(firstUser);
var sessionService = setupSessionService(config, defaultFile, fileStoreProvider); var sessionService = setupSessionService(config, defaultFile, fileStoreProvider);
var mailConfig = setupMailConfig(config, defaultFile, fileStoreProvider); var mailConfig = setupMailConfig(config, defaultFile, fileStoreProvider);
var keyStore = setupKeyStore(config, defaultConfigDir); var keyStore = setupKeyStore(config, configDir);
KeyManager keyManager = new RotatingKeyManager(keyStore); KeyManager keyManager = new RotatingKeyManager(keyStore);
var authService = setupAuthService(config, defaultFile, fileStoreProvider); var authService = setupAuthService(config, defaultFile, fileStoreProvider);
var clientService = setupClientService(config, defaultFile, fileStoreProvider); var clientService = setupClientService(config, defaultFile, fileStoreProvider);

Loading…
Cancel
Save