Home > Blockchain >  How to read application.conf file into databricks?
How to read application.conf file into databricks?

Time:05-21

I am having a application.conf file in ADLS GEN-2. I was trying to read the file into databricks by mounting the container. I was doing below and file is not begin read.

import com.typesafe.config.{Config, ConfigFactory}                                                                                          
val fileConfig = ConfigFactory.parseFile(new File("dbfs:/mnt/configs/application.conf"))
val appConfig = ConfigFactory.load(fileConfig).getConfig("HeNAppConf").getConfig(s"$env")

I am getting error like : No configuration setting found for key 'HeNAppConf'. But I am having

CodePudding user response:

The ConfigFactory class should work only with local file APIs, so it doesn't understand dbfs: style of paths. But you can access data via local file API if you replace dbfs: with /dbfs, like this:

import com.typesafe.config.{Config, ConfigFactory}
val fileConfig = ConfigFactory.parseFile(
  new File("/dbfs/mnt/configs/application.conf"))
  • Related