All checks were successful
/ Build and Test Library Snapshot (pull_request) Successful in 1m26s
20 lines
540 B
Scala
20 lines
540 B
Scala
package gs.config.v0.source
|
|
|
|
import cats.effect.Sync
|
|
import gs.config.v0.ConfigKey
|
|
|
|
/** Environment variable implementation of [[ConfigSource]]. Pulls all values
|
|
* from the system environment that was passed to this process.
|
|
*/
|
|
final class EnvironmentConfigSource[F[_]: Sync] extends ConfigSource[F]:
|
|
|
|
/** @inheritDocs
|
|
*/
|
|
override def getValue(
|
|
key: ConfigKey[?]
|
|
): F[Option[String]] =
|
|
Sync[F].delay(sys.env.get(key.name.toEnvironmentVariable()))
|
|
|
|
/** @inheritDocs
|
|
*/
|
|
override val name: String = "environment"
|