GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Krever/static-config

BranchesTags
Open more actions menu

Latest commit

 

History

9 Commits
9 Commits

Folders and files

NameName
Last commit message
Last commit date
project
project
 
 
src
src
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.sbt
build.sbt
 
 

Repository files navigation

static-config

It is a tiny library allowing to scrap some boilerplate when working with typsafehub/config. It contains less then 10 relevant lines of code, but is still quite usefull.

Install

"com.github.krever" %% "static-config" % "1.1.0"

Usage

application.conf
static-config {
  intEntry = 1
  stringEntry = "String"
  group {
    listEntry = ["val1", "val2"]
    durationEntry = 6h
  }
}
other-config = 2
SConfigExample.scala
import com.typesafe.config.{Config, ConfigFactory}
import staticconfig._

object SConfigExample extends SConfig {

  override def config: Config = ConfigFactory.load()

  object `static-config` extends LocalSConfigNode {
    val intEntry = configEntry(_.getInt)
    val stringEntry = configEntry(_.getString)

    object group extends LocalSConfigNode {
      val listEntry = configEntry(_.getStringList)
      val durationEntry = configEntry(_.getDuration)
    }
  }

  val `other-config` = configEntry(_.getInt)
}

Motivation

It can be found here.

Why not to go further?

We could take one more step and make an sbt-plugin that will generate such code directly from application.conf. Although it might be possible, I'm not a big fan of code generation. Some arguments against it can be found here.

Other libraries

If you're fine with compiler plugin and annotations, there is great wacai/config-annotation.

Other wrappers around Typesafe Config can be found here

About

No description, website, or topics provided.

Resources

Readme
MIT license
Activity

Stars

4 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.