-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fd7a966
commit 30adab3
Showing
12 changed files
with
124 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
protobufVersion=1.6.3 | ||
protobufVersion=1.6.3 | ||
coroutinesVersion=1.8.1-Beta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
common/src/main/kotlin/de/themeparkcraft/audioserver/common/rabbit/RabbitMQListener.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# RabbitMQ | ||
RABBITMQ_HOST=localhost | ||
RABBITMQ_PORT=5672 | ||
RABBITMQ_VHOST=/ | ||
RABBITMQ_USER=guest | ||
RABBITMQ_PASSWORD=guest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dotenvVersion=6.4.1 | ||
fruxzAscendVersion=2024.1.2 | ||
logbackVersion=1.5.6 |
38 changes: 38 additions & 0 deletions
38
standalone/src/main/kotlin/de/themeparkcraft/audioserver/AudioServerStandalone.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package de.themeparkcraft.audioserver | ||
|
||
import de.themeparkcraft.audioserver.common.data.RabbitConfiguration | ||
import de.themeparkcraft.audioserver.common.extensions.getLogger | ||
import de.themeparkcraft.audioserver.common.rabbit.RabbitClient | ||
import de.themeparkcraft.audioserver.utils.Environment | ||
import kotlin.system.exitProcess | ||
|
||
class AudioServerStandalone { | ||
|
||
private val rabbitClient: RabbitClient | ||
|
||
init { | ||
val rabbitConfiguration = RabbitConfiguration( | ||
host = Environment.getEnv("RABBITMQ_HOST") ?: "localhost", | ||
port = Environment.getEnv("RABBITMQ_PORT")?.toInt() ?: 5672, | ||
virtualHost = Environment.getEnv("RABBITMQ_VIRTUAL_HOST") ?: "/", | ||
username = Environment.getEnv("RABBITMQ_USER") ?: "guest", | ||
password = Environment.getEnv("RABBITMQ_PASSWORD") ?: "guest" | ||
) | ||
|
||
getLogger().info("Starting AudioServer standalone at ${rabbitConfiguration.host}:${rabbitConfiguration.port} - (vhost: ${rabbitConfiguration.virtualHost}) with user ${rabbitConfiguration.username}...") | ||
|
||
try { | ||
rabbitClient = RabbitClient(rabbitConfiguration) | ||
|
||
rabbitClient.withListener { message, delivery -> | ||
getLogger().info("Received message: $message") | ||
} | ||
|
||
getLogger().info("AudioServer standalone started.") | ||
} catch (exception: Exception) { | ||
getLogger().error("Failed to start AudioServer standalone due to the following exception: ", exception) | ||
exitProcess(1) | ||
} | ||
} | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
standalone/src/main/kotlin/de/themeparkcraft/audioserver/Start.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package de.themeparkcraft.audioserver | ||
|
||
fun main() { | ||
AudioServerStandalone() | ||
} |
22 changes: 22 additions & 0 deletions
22
standalone/src/main/kotlin/de/themeparkcraft/audioserver/utils/Environment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package de.themeparkcraft.audioserver.utils | ||
|
||
import io.github.cdimascio.dotenv.dotenv | ||
|
||
object Environment { | ||
|
||
private val env = System.getenv() | ||
private val dotEnv = dotenv { | ||
ignoreIfMissing = true | ||
} | ||
|
||
/** | ||
* Retrieves the value of the environment variable with the specified key. | ||
* | ||
* @param key The key of the environment variable. | ||
* @return The value of the environment variable, or null if the variable is not found. | ||
*/ | ||
fun getEnv(key: String): String? { | ||
return dotEnv[key] ?: env[key] | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<configuration> | ||
<!-- Configure the Console appender --> | ||
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<!-- Enable the Console and Sentry appenders, Console is provided as an example | ||
of a non-Sentry logger that is set to a different logging threshold --> | ||
<root level="INFO"> | ||
<appender-ref ref="Console"/> | ||
</root> | ||
</configuration> |