From 0bdefbf053beb80736eff0a13fe8b90618c8d6dc Mon Sep 17 00:00:00 2001
From: Kai Reinhard <K.Reinhard@micromata.de>
Date: Fri, 21 Dec 2018 22:56:09 +0000
Subject: [PATCH] ServerConfiguration is also stored in json.
---
borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ConfigurationRest.java | 23 ++++-------------------
1 files changed, 4 insertions(+), 19 deletions(-)
diff --git a/borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ConfigurationRest.java b/borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ConfigurationRest.java
index 15e7f45..06abb81 100644
--- a/borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ConfigurationRest.java
+++ b/borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ConfigurationRest.java
@@ -1,9 +1,9 @@
package de.micromata.borgbutler.server.rest;
import de.micromata.borgbutler.cache.ButlerCache;
+import de.micromata.borgbutler.config.ConfigurationHandler;
import de.micromata.borgbutler.json.JsonUtils;
import de.micromata.borgbutler.server.ServerConfiguration;
-import de.micromata.borgbutler.server.ServerConfigurationHandler;
import de.micromata.borgbutler.server.user.UserData;
import de.micromata.borgbutler.server.user.UserManager;
import org.apache.commons.lang3.StringUtils;
@@ -26,9 +26,7 @@
* @see JsonUtils#toJson(Object, boolean)
*/
public String getConfig(@QueryParam("prettyPrinter") boolean prettyPrinter) {
- ServerConfiguration config = new ServerConfiguration();
- config.copyFrom(ServerConfigurationHandler.getInstance().getConfiguration());
- String json = JsonUtils.toJson(config, prettyPrinter);
+ String json = JsonUtils.toJson(ServerConfiguration.get(), prettyPrinter);
return json;
}
@@ -36,8 +34,8 @@
@Path("config")
@Produces(MediaType.TEXT_PLAIN)
public void setConfig(String jsonConfig) {
- ServerConfigurationHandler configurationHandler = ServerConfigurationHandler.getInstance();
- ServerConfiguration config = configurationHandler.getConfiguration();
+ ConfigurationHandler configurationHandler = ConfigurationHandler.getInstance();
+ ServerConfiguration config = (ServerConfiguration)configurationHandler.getConfiguration();
ServerConfiguration srcConfig = JsonUtils.fromJson(ServerConfiguration.class, jsonConfig);
config.copyFrom(srcConfig);
configurationHandler.save();
@@ -77,19 +75,6 @@
* Resets the settings to default values (deletes all settings).
*/
@GET
- @Path("reset")
- @Produces(MediaType.APPLICATION_JSON)
- public String resetConfig(@QueryParam("IKnowWhatImDoing") boolean securityQuestion) {
- if (securityQuestion) {
- ServerConfigurationHandler.getInstance().removeAllSettings();
- }
- return getConfig(false);
- }
-
- /**
- * Resets the settings to default values (deletes all settings).
- */
- @GET
@Path("clearAllCaches")
@Produces(MediaType.APPLICATION_JSON)
public String clearAllCaches() {
--
Gitblit v1.10.0