Skip to content

Commit

Permalink
core: cleanup check
Browse files Browse the repository at this point in the history
  • Loading branch information
ElysaSrc committed Jul 17, 2024
1 parent e3b41bd commit bfb77d6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions core/src/main/java/fr/sncf/osrd/cli/WorkerCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,24 @@ class WorkerCommand : CliCommand {
private var threads: Int = 1


val WORKER_ID: String
val WORKER_KEY: String
val WORKER_ID: String?
val WORKER_KEY: String?
val WORKER_AMQP_URI: String
val WORKER_POOL: String
val WORKER_REQUESTS_QUEUE: String
val WORKER_ACTIVITY_EXCHANGE: String

init {
WORKER_ID = System.getenv("WORKER_ID") ?: "worker_id_undefined"
WORKER_KEY = System.getenv("WORKER_KEY") ?: "worker_key_undefined"
WORKER_ID = System.getenv("WORKER_ID")
WORKER_KEY = System.getenv("WORKER_KEY")
WORKER_AMQP_URI = System.getenv("WORKER_AMQP_URI") ?: "amqp://osrd:[email protected]:5672/%2f"
WORKER_POOL = System.getenv("WORKER_POOL") ?: "core"
WORKER_REQUESTS_QUEUE = System.getenv("WORKER_REQUESTS_QUEUE") ?: "$WORKER_POOL-req-$WORKER_KEY"
WORKER_ACTIVITY_EXCHANGE = System.getenv("WORKER_ACTIVITY_EXCHANGE") ?: "$WORKER_POOL-activity-xchg"
}

override fun run(): Int {
if (WORKER_ID == "worker_id_undefined" || WORKER_KEY == "worker_key_undefined") {
// TODO (Élyse): Check if this ok with Khoyo
if (WORKER_ID == null || WORKER_KEY == null) {
throw IllegalStateException("Environment variables WORKER_ID or WORKER_KEY are not set properly.")
}

Expand Down

0 comments on commit bfb77d6

Please sign in to comment.