-
Book Overview & Buying
-
Table Of Contents
Data Engineering with Scala and Spark
By :
Before proceeding further, let’s address one of the issues with code that you might have noticed already—we are passing the credentials as clear text, which is not only a bad practice but also poses a major security risk. In production code, secrets are supplied as environment variables and loaded at runtime by a configuration loader.
For this book, we are going to use PureConfig to load the configuration: https://pureconfig.github.io/docs/index.html.
In order to add PureConfig to your project, you need to add the following dependency in your build.sbt file:
libraryDependencies += "com.github.pureconfig" %% "pureconfig" % "0.17.2"
Example 4.13
For this section, we are interested in loading the database configuration at runtime. For that, we can create a Config file with the following case classes and a helper object:
package com.packt.dewithscala import pureconfig._ import pureconfig.generic...