Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
src
README.md
build.sbt

README.md

Cron4s module for PureConfig

Adds support for Cron4s's CronExpr class to PureConfig.

Add pureconfig-cron4s to your project

In addition to core PureConfig, you'll need:

libraryDependencies += "com.github.pureconfig" %% "pureconfig-cron4s" % "0.12.1"

Example

To load an CronExpr into a configuration, create a class to hold it:

import cron4s.expr.CronExpr
import com.typesafe.config.ConfigFactory.parseString
import pureconfig._
import pureconfig.generic.auto._
import pureconfig.module.cron4s._

case class MyConfig(schedule: CronExpr)

We can read a MyConfig with the following code:

val conf = parseString("""{ schedule: "10-35 2,4,6 * ? * *" }""")
// conf: com.typesafe.config.Config = Config(SimpleConfigObject({"schedule":"10-35 2,4,6 * ? * *"}))

ConfigSource.fromConfig(conf).load[MyConfig]
// res0: pureconfig.ConfigReader.Result[MyConfig] = Right(MyConfig(10-35 2,4,6 * ? * *))
You can’t perform that action at this time.