com.oath.micro.server.ip.tracker.BeanConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of micro-ip-tracker Show documentation
Show all versions of micro-ip-tracker Show documentation
Opinionated rest microservices
The newest version!
package com.oath.micro.server.ip.tracker;
import javax.servlet.Filter;
import cyclops.control.Either;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.oath.micro.server.auto.discovery.FilterConfiguration;
@Configuration
public class BeanConfiguration {
@Value("${load.balancer.ip.forwarding.header:X-LB-Client-IP}")
String ipForwardingHeaderValue;
@Value("${ip.tracker.mappings:/*}")
String[] mappingsValue;
@Bean
public FilterConfiguration ipTracker(){
return new FilterConfiguration(){
@Override
public String[] getMapping() {
return mappingsValue;
}
@Override
public Either, Filter> getFilter() {
return Either.right(new QueryIPRetriever(ipForwardingHeaderValue, mappingsValue));
}
};
}
}