All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.bjoernpetersen.musicbot.api.config.ConfigManager.kt Maven / Gradle / Ivy

There is a newer version: 0.25.0
Show newest version
package net.bjoernpetersen.musicbot.api.config

import net.bjoernpetersen.musicbot.spi.config.ConfigStorageAdapter

class ConfigManager(
    private val plainStorageAdapter: ConfigStorageAdapter,
    private val secretStorageAdapter: ConfigStorageAdapter,
    private val stateStorageAdapter: ConfigStorageAdapter) {

    private val configs: MutableMap = HashMap()

    operator fun get(scope: ConfigScope): Configs = configs.computeIfAbsent(scope) {
        Configs(
            plain = Config(plainStorageAdapter, it),
            secrets = Config(secretStorageAdapter, it),
            state = Config(stateStorageAdapter, it)
        )
    }
}

data class Configs(
    val plain: Config,
    val secrets: Config,
    val state: Config)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy