- Notifications
You must be signed in to change notification settings - Fork19
Simple pure-scala Typesafe HOCON implementation using FastParse
License
akka-js/shocon
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
SHocon is a simple, pure-Scala, alternative implementation of theHOCONspecification.
SHocon ships with a native, Scala-idiomatic API, and a shim that mimics theTypesafe Config Java API, making it well-suited as adrop-in replacement wherever the Java implementation is not available, such asScala.JS orScala Native projects.
This implementation does not cover all of the corner cases of the original implementation. Issues and PRs are welcome!
Add these lines to yourproject/plugins.sbt:
addSbtPlugin("org.akka-js"%"sbt-shocon"%"1.0.0")
and inbuild.sbt:
valroot= project.in(file(".")) .enablePlugins(ShoconPlugin) .settings( libraryDependencies+="org.akka-js"%%"shocon"%"1.0.0",// for Scala.js/Native or cross projects use %%% instead:// libraryDependencies += "org.akka-js" %%% "shocon" % "1.0.0"// add dependency on shocon file generation task// (not required, but otherwise you need to call shoconConcat manually before compilation!) compile inCompile:= (compile inCompile).dependsOn(shoconConcat).value/* ...*/ )
SHocon wouldn't have been possible without the enormous support of the R&D department of UniCredit lead by Riccardo Prodam. Started as a side-project it quickly grew into an important open source milestone.Check out other projects from the UniCredit teamhere
Starting from shocon1.0.0 we dropped support for Scala.Js0.6, the latest artifact published for Scala.Js0.6 is Shocon0.5.0
In contrast to Typesafe config, which loads configuration files dynamically at run time, shocon compiles the default configuration returned byConfigFactory.load() statically into the the code. This includes allreference.conf files found in theresources directory of the project itself, as well as allreference.conf files found in JARs on which the project depends. If there is anapplication.conf file in theresources directory of the project, this one will be included as well (after allreference.conf files).
The resulting HOCON configuration file is assembled intarget/scala-VERSION/shocon.conf.
Note: For Scala.JS / Native / JVM projects only thereference.config files located in eitherjs/src/main/resources andjvm/src/main/resources are included; files inshared/src/main/resources/ are ignored!
Since version0.3.1 the parse phase is aggressively moved at compile time, please note that runtime parsing cost a lot in terms of performances.
You can control the contents of the included default configuration with the following sbt settings:
shoconLoadFromJars: set to false, if you don't want to include anyreference.conffiles found in JARsshoconFilter: Function1[(String,InputStream), Boolean]: set this setting to a filter function that returntruefor all configuration files to be included; the first element in the tuple passed to the function is the absolute URL of the configuration file.
About
Simple pure-scala Typesafe HOCON implementation using FastParse
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
