如何在logom应用程序中更改服务网关的端口?

时间:2016-03-25 13:09:57

标签: lagom

我已经创建了入门的lagom应用程序http://www.lagomframework.com/documentation/1.0.x/GettingStarted.html

系统正常运行。

[info] Service locator is running at http://localhost:8000
[info] Service gateway is running at http://localhost:9000
[info] application - Signalled start to ConductR
[info] application - Signalled start to ConductR
[info] Service hellostream-impl listening for HTTP on 0:0:0:0:0:0:0:0:26230
[info] Service helloworld-impl listening for HTTP on 0:0:0:0:0:0:0:0:24266

如何更改服务网关的主机和端口以侦听0.0.0.0:8080?

1 个答案:

答案 0 :(得分:4)

  1. 主机名似乎没问题。可以从另一台机器访问该服务。 localhost是硬编码的。

    def serviceGatewayAddress: URI = {
        new URI(s"http://localhost:${gateway.address.getPort}")
    }
    

    请参阅https://github.com/lagom/lagom/blob/1.0.0-M1/dev/service-locator/src/main/scala/com/lightbend/lagom/discovery/ServiceLocatorServer.scala#L71

  2. 要配置服务网关的端口,请在主lagomServiceGatewayPort中设置属性build.sbt

    lagomServiceGatewayPort in ThisBuild := 8080