summaryrefslogtreecommitdiff
path: root/opendc-common/src/main/kotlin/org/opendc/common/utils/ConfigParser.kt
diff options
context:
space:
mode:
authormjkwiatkowski <mati.rewa@gmail.com>2026-02-20 16:17:39 +0100
committermjkwiatkowski <mati.rewa@gmail.com>2026-02-20 16:17:39 +0100
commitf5da60e4275ca1172128c3994298691e12d5e1f8 (patch)
tree189804251bf88bf390e1c9ffb4472b7a798d7f22 /opendc-common/src/main/kotlin/org/opendc/common/utils/ConfigParser.kt
parent2f16cb0f48eca4453e3e894b3d45a3aa09e6dcc0 (diff)
fix: changed the syntex to slowly get rid of the Config classHEADmaster
Diffstat (limited to 'opendc-common/src/main/kotlin/org/opendc/common/utils/ConfigParser.kt')
-rw-r--r--opendc-common/src/main/kotlin/org/opendc/common/utils/ConfigParser.kt13
1 files changed, 11 insertions, 2 deletions
diff --git a/opendc-common/src/main/kotlin/org/opendc/common/utils/ConfigParser.kt b/opendc-common/src/main/kotlin/org/opendc/common/utils/ConfigParser.kt
index e6f18da5..8261f6f0 100644
--- a/opendc-common/src/main/kotlin/org/opendc/common/utils/ConfigParser.kt
+++ b/opendc-common/src/main/kotlin/org/opendc/common/utils/ConfigParser.kt
@@ -13,7 +13,6 @@ import java.net.Socket
import java.sql.Connection
/**
- * @author Mateusz
* @property name
* @property backlog the amount of connections to accept
* @property address IPv4 address
@@ -22,8 +21,14 @@ import java.sql.Connection
* @property username Postgresql user
* @property password Postgresql password
* @property database Postgresql database
- * @property topic Kafka topic
+ * @property topic Kafka topic and database table name
* @property kafka Kafka port
+ * @author Mateusz
+ */
+/*
+
+ Use `by lazy` here.
+ Use design patterns - singleton.
*/
@Serializable
public data class Config(
@@ -50,6 +55,10 @@ public data class Config(
public fun setConfigSocket(socket: Socket?){
this.socket = socket
+ // no try catch if the exception is not from Java
+ // do not use raw sockets, use a service for the communication
+ // use redis instead of HTTP GET (consider it, but not bound in stone)
+ // make an API KTor
try {
input = socket?.getInputStream()
output = socket?.getOutputStream()