-
Notifications
You must be signed in to change notification settings - Fork 15
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
582896c
commit 4d377f8
Showing
20 changed files
with
596 additions
and
85 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
Binary file not shown.
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 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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 |
---|---|---|
|
@@ -35,4 +35,6 @@ open class FileResolver( | |
} | ||
return File(baseDir, path) | ||
} | ||
|
||
fun file() = baseDir | ||
} |
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
28 changes: 28 additions & 0 deletions
28
src/main/kotlin/io/emeraldpay/dshackle/config/reload/ReloadConfigService.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,28 @@ | ||
package io.emeraldpay.dshackle.config.reload | ||
|
||
import io.emeraldpay.dshackle.Config | ||
import io.emeraldpay.dshackle.FileResolver | ||
import io.emeraldpay.dshackle.config.MainConfig | ||
import io.emeraldpay.dshackle.config.UpstreamsConfig | ||
import io.emeraldpay.dshackle.config.UpstreamsConfigReader | ||
import io.emeraldpay.dshackle.foundation.ChainOptionsReader | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class ReloadConfigService( | ||
private val config: Config, | ||
fileResolver: FileResolver, | ||
private val mainConfig: MainConfig, | ||
|
||
) { | ||
private val optionsReader = ChainOptionsReader() | ||
private val upstreamsConfigReader = UpstreamsConfigReader(fileResolver, optionsReader) | ||
|
||
fun readUpstreamsConfig() = upstreamsConfigReader.read(config.getConfigPath().inputStream())!! | ||
|
||
fun currentUpstreamsConfig() = mainConfig.upstreams!! | ||
|
||
fun updateUpstreamsConfig(newConfig: UpstreamsConfig) { | ||
mainConfig.upstreams = newConfig | ||
} | ||
} |
Oops, something went wrong.