-
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
Showing
5 changed files
with
46 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ korge { | |
id = "com.sample.clientserver" | ||
targetJvm() | ||
targetJs() | ||
targetDesktop() | ||
targetDesktopCross() | ||
} | ||
|
||
|
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,30 @@ | ||
import io.ktor.client.engine.winhttp.* | ||
import korlibs.io.file.std.resourcesVfs | ||
import korlibs.io.lang.readProperties | ||
import network.ClientEngineFactory | ||
import network.URLProvider | ||
import org.koin.core.context.startKoin | ||
import org.koin.core.qualifier.named | ||
import org.koin.dsl.bind | ||
import org.koin.dsl.module | ||
import org.koin.mp.KoinPlatform | ||
|
||
class Main | ||
suspend fun main() { | ||
val clientProps = resourcesVfs["client.properties"].readProperties() | ||
val url = clientProps["server"]!! | ||
val version = clientProps["version"]!! | ||
startKoin {} | ||
KoinPlatform.getKoin().loadModules(listOf(module { | ||
single(named("version")) { version } | ||
factory { | ||
object : URLProvider { | ||
override val url: String get() = url | ||
} | ||
} bind URLProvider::class | ||
factory { | ||
object : ClientEngineFactory { override fun getEngine() = WinHttp } | ||
} bind ClientEngineFactory::class | ||
})) | ||
start() | ||
} |
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