Switch HOCON dependency from typesafe-config to Jig

Jig (ma.chinespirit::jig) is the SummerCMS standard for HOCON.
Uses sconfig under the hood (no Java deps, Scala Native
compatible). Adapts HoconLoader to sconfig's parameterless method style.
This commit is contained in:
Jakub Zych
2026-02-23 00:39:02 +01:00
parent 8684d2fb7b
commit 6e923eea45
2 changed files with 5 additions and 4 deletions

View File

@@ -6,7 +6,7 @@ lazy val root = (project in file("."))
scalaVersion := "3.3.4",
libraryDependencies ++= Seq(
"com.typesafe" % "config" % "1.4.3",
"ma.chinespirit" %% "jig" % "0.1.0",
"org.scalameta" %% "munit" % "1.0.3" % Test,
),

View File

@@ -1,6 +1,7 @@
package summer.phrasebook
import com.typesafe.config.{Config, ConfigFactory, ConfigValueType}
import machinespir.it.jig.{Config, ConfigFactory}
import org.ekrich.config.ConfigValueType
import java.nio.file.{Files, Path}
import scala.jdk.CollectionConverters.*
@@ -39,10 +40,10 @@ object HoconLoader:
/** Flatten a Typesafe Config into a string map. */
def flatten(config: Config): Map[String, String] =
val builder = Map.newBuilder[String, String]
for entry <- config.entrySet().asScala do
for entry <- config.entrySet.asScala do
val key = entry.getKey.nn
val value = entry.getValue.nn
value.valueType() match
value.valueType match
case ConfigValueType.STRING | ConfigValueType.NUMBER | ConfigValueType.BOOLEAN =>
builder += key -> config.getString(key).nn
case ConfigValueType.NULL =>