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

net.nemerosa.ontrack.extension.vault.VaultConfig.kt Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
package net.nemerosa.ontrack.extension.vault

import net.nemerosa.ontrack.model.support.OntrackConfigProperties
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.context.annotation.Configuration
import org.springframework.vault.authentication.ClientAuthentication
import org.springframework.vault.authentication.TokenAuthentication
import org.springframework.vault.client.VaultEndpoint
import org.springframework.vault.config.AbstractVaultConfiguration
import java.net.URI

@Configuration
@ConditionalOnProperty(name = [OntrackConfigProperties.KEY_STORE], havingValue = VaultExtensionFeature.VAULT_KEY_STORE_PROPERTY)
class VaultConfig(
        private val configProperties: VaultConfigProperties
) : AbstractVaultConfiguration() {

    override fun vaultEndpoint(): VaultEndpoint = VaultEndpoint.from(URI.create(configProperties.uri))

    override fun clientAuthentication(): ClientAuthentication = TokenAuthentication(
            configProperties.token
    )

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy