Skip to content

Commit

Permalink
Add forgotten file
Browse files Browse the repository at this point in the history
  • Loading branch information
anti-social committed Mar 24, 2023
1 parent 1f54639 commit b3f0ba6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions integ-tests/src/commonTest/kotlin/dev/evo/elasticmagic/env.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package dev.evo.elasticmagic

import dev.evo.elasticmagic.transport.Auth

expect fun getenv(name: String): String?

const val DEFAULT_ELASTIC_URL = "http://localhost:9200"
const val DEFAULT_ELASTIC_USER = "elastic"

val elasticUrl = getenv("ELASTIC_URL") ?: DEFAULT_ELASTIC_URL

val elasticAuth = when (val elasticPassword = getenv("ELASTIC_PASSWORD")) {
null -> null
else -> Auth.Basic(
getenv("ELASTIC_USER") ?: DEFAULT_ELASTIC_USER,
elasticPassword
)
}

0 comments on commit b3f0ba6

Please sign in to comment.