Unmanaged service url configuration outside of sbt or maven

java

(Zeljko) #1

Is there a way to configure unmanaged external service’s URL without fixing the value in maven or sbt configuration?


(Alan Klikic) #2

You could use LagomClientFactory

There you can set url in runtime how ever you want.
You do not bind the service API that you use but create via factory


(Zeljko) #3

Found the solution here: https://www.lagomframework.com/documentation/1.4.x/scala/ProductionOverview.html#Using-static-values-for-services-and-Cassandra

So maven config is used in dev mode, and for production mode lagom.services property in the configuration is read by ConfigurationServiceLocator


(Zeljko) #4

Yeah did that initially, but creating a separate client factory did not seem right because there already is one client factory created.
It’s more designed for non lagom services to call lagom services


(Alan Klikic) #5

@zeljko.kunica it depends for what you need it for.
Factory is the only way, that I know, to set a url dynamically in runtime.
For static definitions you can use configration based service locator as you mentioned and for kubernetes Lightbend provided service locator with ExternalName

In case you plan to use the factory in some other case check also this issue