title: How to load typesafe configFactory from file on hdfs?
body: <p>I am using typesafe ConfigFactory to load the config into my scala application. I do not want to include the config files into my jar, but load them instead from an external hdfs filesystem. However, I cannot find a simple way to load the config from the fsDataInputStream object I get from hadoop: </p>
  
  <pre><code>//get HDFS file
  val hadoopConfig: Configuration = sc.hadoopConfiguration
  val fs: FileSystem = org.apache.hadoop.fs.FileSystem.get(hadoopConfig)
  val file: FSDataInputStream = fs.open(new Path("hdfs://SOME_URL/application.conf"))
  //read config from hdfs
  val config: Config = ConfigFactory.load(file.readUTF())
  </code></pre>
  
  <p>However, this throws an EOFException. Is there an easy way to convert the FSDataInputStream object into the required java.io.File? I found <a href="https://stackoverflow.com/questions/19099582/converting-from-fsdatainputstream-to-fileinputstream">Converting from FSDataInputStream to FileInputStream</a> , but this would be pretty cumbersome for such a simple task. </p>