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

io.github.kijuky.zio.jira.JiraService.scala Maven / Gradle / Ivy

There is a newer version: 1.2.4
Show newest version
package io.github.kijuky.zio.jira

import zio.*

object JiraService {
  def layer(serverUri: String = "", accessToken: String = ""): TaskLayer[Jira] =
    ZLayer.scoped {
      ZIO.acquireRelease {
        for {
          optServerUri <- System.env("JIRA_SERVER_URI")
          serverUri <- ZIO.succeed(optServerUri.getOrElse(serverUri))
          optAccessToken <- System.env("JIRA_ACCESS_TOKEN")
          accessToken <- ZIO.succeed(optAccessToken.getOrElse(accessToken))
        } yield Jira(serverUri, accessToken)
      } { jira =>
        ZIO.succeed(jira.close())
      }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy