Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autocreate default config if none was found #781

Merged
merged 3 commits into from
Nov 24, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions LavalinkServer/src/main/java/lavalink/server/Launcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ object Launcher {
val config = File("./application.yml")
if (!config.exists()) {
log.info("No application.yml found, creating one...")
Launcher::class.java.getResource("/application.yml.example")
?.openStream()
?.use {
Launcher::class.java.getResource("/application.yml.example")?.let {
it.openStream()?.use {
if (!config.createNewFile()) {
log.error("Unable to create application.yml")
return
Expand All @@ -136,6 +135,9 @@ object Launcher {
it.copyTo(out)
}
}
} ?: run {
topi314 marked this conversation as resolved.
Show resolved Hide resolved
log.error("Unable to find application.yml.example in resources")
}
}

val parent = launchPluginBootstrap()
Expand Down