zalando-nakadi / nakadi-producer-spring-boot-starter

Nakadi event producer as a Spring boot starter
MIT License
13 stars 8 forks source link

Provide a KubernetesTokenConfiguration #79

Closed ePaul closed 6 years ago

ePaul commented 6 years ago

When deploying an app in our Kubernetes infrastructure, the app doesn't fetch the token from some URI anymore, but the token is directly put into the file system. The tokens library can already work with this, but needs a different configuration in this case.

An application can currently do this by providing an own AccessTokenProvider bean, e.g. like this:

@Bean   
public org.zalando.nakadiproducer.AccessTokenProvider nakadiProducerAccessTokenProvider() { 
        return () -> accessTokens.get("nakadi");    
}

(This is assuming that accessTokens is a properly pre-configured AccessTokens bean, e.g. the one autoconfigured from tokens-spring-boot-starter, and there is a token named nakadi in there).

Our library should be able to discover such an existing AccessTokens bean itself and use it, instead of having to build its own one. (It should only be used if no Fahrschein NakadiClient is already there, though, see #75 .)

ePaul commented 6 years ago

Hmm, I guess the proposed solution is a duplicate to #10.