Skip to content

Commit

Permalink
refactored config parsing methods
Browse files Browse the repository at this point in the history
  • Loading branch information
albogdano committed Oct 27, 2024
1 parent 2af94bb commit 49b9681
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<dependency>
<groupId>com.erudika</groupId>
<artifactId>para-client</artifactId>
<version>1.50.2</version>
<version>1.50.3-SNAPSHOT</version>
</dependency>

<!-- VELOCITY -->
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/erudika/scoold/ScooldServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import com.erudika.scoold.utils.ScooldUtils;
import com.erudika.scoold.velocity.VelocityConfigurer;
import com.erudika.scoold.velocity.VelocityViewResolver;
import com.typesafe.config.ConfigFactory;
import jakarta.inject.Named;
import java.io.File;
import java.nio.file.Files;
Expand Down Expand Up @@ -286,7 +285,8 @@ private void tryAutoInitParaApp() {
if (!CONF.autoInitWithRootAppSecretKey().isBlank()) {
rootSecret = CONF.autoInitWithRootAppSecretKey().trim();
} else if (!CONF.autoInitWithParaConfigFile().isBlank()) {
com.typesafe.config.Config paraConfig = ConfigFactory.parseFile(new File(CONF.autoInitWithParaConfigFile()));
com.typesafe.config.Config paraConfig =
Config.parseFileWithoutIncludes(new File(CONF.autoInitWithParaConfigFile()));
if (paraConfig.hasPath("para.root_secret_key")) {
rootSecret = paraConfig.getString("para.root_secret_key");
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/erudika/scoold/api/ApiController.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import com.erudika.scoold.utils.BadRequestException;
import com.erudika.scoold.utils.ScooldUtils;
import com.erudika.scoold.utils.Version;
import com.typesafe.config.ConfigFactory;
import com.typesafe.config.ConfigValue;
import jakarta.inject.Inject;
import jakarta.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -1058,7 +1057,7 @@ public String configSet(HttpServletRequest req, HttpServletResponse res) {
if ("application/hocon".equals(req.getContentType())) {
try {
String config = IOUtils.toString(req.getInputStream(), "utf-8");
for (Map.Entry<String, ConfigValue> entry : ConfigFactory.parseString(config).entrySet()) {
for (Map.Entry<String, ConfigValue> entry : Config.parseStringWithoutIncludes(config).entrySet()) {
System.setProperty(entry.getKey(), entry.getValue().unwrapped().toString());
}
} catch (IOException ex) {
Expand Down

0 comments on commit 49b9681

Please sign in to comment.