gs-config/src/main/scala/gs/config/v0/source/EnvironmentConfigSource.scala
Pat Garrity f127645860
All checks were successful
/ Build and Release Library (push) Successful in 1m29s
(patch) Initial implementation of the configuration library. (#1)
Reviewed-on: #1
2024-05-02 02:56:00 +00:00

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"