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

io.funkode.arangodb.ArangoConfiguration.scala Maven / Gradle / Ivy

There is a newer version: 0.3.6
Show newest version
/*
 * Copyright 2022 Carlos Verdes
 *
 * SPDX-License-Identifier: MIT
 */

package io.funkode.arangodb

import java.util.concurrent.TimeUnit.*

import scala.concurrent.duration.*

import zio.config.*
import zio.config.magnolia.*
import zio.config.typesafe.*

final case class ArangoConfiguration(
    host: String,
    port: Int = ArangoConfiguration.DefaultPort,
    username: String,
    password: String,
    chunkLength: Long = ArangoConfiguration.ChunkLengthDefault,
    readBufferSize: Int = ArangoConfiguration.ReadBufferSizeDefault,
    connectTimeout: Duration = ArangoConfiguration.ConnectTimeoutDefault,
    replyTimeout: Duration = ArangoConfiguration.ReplyTimeoutDefault,
    database: model.DatabaseName = model.DatabaseName.system
)

object ArangoConfiguration:

  import ConfigDescriptor.nested

  val DefaultPort = 8529
  val ChunkLengthDefault: Long = 30000L
  val ReadBufferSizeDefault: Int = 256 * 1024
  val ConnectTimeoutDefault: Duration = 10.seconds
  val ReplyTimeoutDefault: Duration = 30.seconds

  @SuppressWarnings(Array("stryker4s.mutation.StringLiteral"))
  val DefaultPath = "arangodb"

  val arangoConfigDescriptor = descriptor[ArangoConfiguration].mapKey(toKebabCase)

  def fromPath(path: String) = TypesafeConfig.fromResourcePath(nested(path)(arangoConfigDescriptor))
  val default = fromPath(DefaultPath)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy