Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Simple pure-scala Typesafe HOCON implementation using FastParse

License

NotificationsYou must be signed in to change notification settings

akka-js/shocon

Repository files navigation

Build Status

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!

Usage

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/* ...*/  )

Credits

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

Notes

Scala.Js support

Starting from shocon1.0.0 we dropped support for Scala.Js0.6, the latest artifact published for Scala.Js0.6 is Shocon0.5.0

Loading of default configuration

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.

ShoconPlugin settings

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.conf files found in JARs
  • shoconFilter: Function1[(String,InputStream), Boolean]: set this setting to a filter function that returntrue for 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

Stars

Watchers

Forks

Packages

No packages published

Contributors16


[8]ページ先頭

©2009-2026 Movatter.jp