question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SBT application.conf support?

See original GitHub issue

I’ve looked through the documentation for a half hour and done some experimentation but can’t seem to figure this out. Sorry if I missed something obvious somewhere. Right now it looks like for SBT you’re stuck doing this for database credentials in build.sbt:

flywayUrl := ""
flywayUser := ""
flywayPassword := ""
flywayDriver := ""

Is there a way to support an application.conf style file for providing these values? Something like:

flyway.url = xxxx

or

flyway { 
    url = xxx
}

being used for the flywayUrl and similar keys? If possible using db.default.url would be great, as I’m trying to not repeat my db credentials multiple times in multiple places. But if support for application.conf or a properties file could be made that would be really useful.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nafgcommented, Sep 3, 2015

I just recently dealt with this. Here’s my solution:

project/Conf.scala

import sbt._

object Conf {
  lazy val dbConf = settingKey[(String, String, String)]("Typesafe config file with slick settings")
}

In build.sbt

Conf.dbConf := {
  val cfg = ConfigFactory.parseFile((resourceDirectory in Compile).value / "application.conf")
  val prefix = "slick.dbs.default.db"
  (cfg.getString(s"$prefix.url"), cfg.getString(s"$prefix.user"), cfg.getString(s"$prefix.password"))
}

flyway.sbt

(If you prefer you can put this in build.sbt instead)

flywaySettings

flywayUrl := Conf.dbConf.value._1
flywayUser := Conf.dbConf.value._2
flywayPassword := Conf.dbConf.value._3
0reactions
arturazcommented, Dec 10, 2016

I think this isn’t integration, but documentation issue. There’s only a few lines of code to be written for the integration and they could be provided as an example in the https://flywaydb.org/getstarted/firststeps/sbt page.

I could write them if you’re up for the idea.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build the same package with different configs - SBT
The main idea is to create a submodule per configuration. We start with a simple project build.sbt . name := "my-app" enablePlugins(JavaAppPackaging).
Read more >
application.conf for Scala SBT Akka Actors - Stack Overflow
I was wondering.. where do you put the application.conf file that configures actors in a file ...
Read more >
Quick Start - PureConfig
To use PureConfig in an existing SBT project with Scala 2.12 or a later version ... Second, create an application.conf file and add...
Read more >
sbt/sbt-native-packager - Gitter
in application.conf , Just set {logback-file-path = ${?LOGBACK_PATH}} and pass environment variable to docker. -e LOGBACK_PATH = logback-prod.xml.
Read more >
Config File - 2.8.x - Play Framework
As well as the application.conf file, configuration comes from a couple of ... You can configure extra settings for the run command in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found