Skip to content

sheinbergon/governator-vault

Repository files navigation

governator-vault

Build Status License Maven Central GitHub release

This library provides smooth integration between Hashicorp's Vault and Netflix's Governator (Guice), allowing you to store and retrieve your application configuration transparently from the vault.

Up ahead on the roadmap :

  • More tests
  • More examples
  • Better support for token renewals
  • Multiple secrets/namespaces support
  • Different auth-backends support (currently, only App-Role is supported).
  • Nested data-structures (???)

Usage

Dependency configuration

Artifacts are available in maven central.

Maven:
<dependency>
    <groupId>org.sheinbergon</groupId>
    <artifactId>governator-vault</artifactId>
    <version>1.17.4</version>
</dependency>
Gradle:
compile "org.sheinbergon:governator-vault:1.17.4"

Simple setup:

BootstrapModule bootstrapModule = new VaultConfigurationProviderBoostrapModule(
                SECRET_PATH,VARIABLE_VALUES,
                VaultConfigBuilder
                    .start()
                    .token(VAULT_TOKEN)
                    .address(VAULT_URL)
                    .build();
                vaultConfig());

Where :

  • SECRET_PATH - Path to the vault secret stroing all of the configuration parameters ( WITHOUT leading '/')
  • VARIABLE_VALUES - A Map<String,String> of dynamic configuration variables as described here
  • VAULT_TOKEN - Vault access token (GUID), as provided/generated by the vault overseer
  • VAULT_URL - Vault access url.

Governator/Guice integration:

LifeCycleInjector injector = LifecycleInjector.builder().
                withBootstrapModule(bootstrapModule).
                withModules(...).
                requiringExplicitBindings().
                build().
                createInjector();

        LifecycleManager manager = injector.getInstance(LifecycleManager.class);
        manager.start();