All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scaladog.ReadEnv.scala Maven / Gradle / Ivy

package scaladog

import scaladog.api.DatadogSite

trait ReadEnv {
  protected def readEnv(key: String): String = {
    sys.env.getOrElse(
      key,
      throw new IllegalArgumentException(s"scaladog initialization failed: Environment variable $key is not found.")
    )
  }

  protected def readEnvSite(): DatadogSite =
    sys.env
      .get("DATADOG_SITE")
      .map { env =>
        DatadogSite
          .withNameInsensitiveOption(env)
          .getOrElse(
            throw new IllegalArgumentException(
              s"scaladog initialization failed: Unsupported site $env"
            )
          )
      }
      .getOrElse(DatadogSite.US)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy