@@ -2,32 +2,24 @@ package bootstrap.http4s
22
33import cats .effect ._
44import code .api .util .APIUtil
5- import code .api .util .http4s .Http4sApp
5+ import code .api .util .http4s .{ Http4sApp , Http4sConfigUtil }
66import com .comcast .ip4s ._
7- import org .http4s .Uri
87import org .http4s .ember .server ._
98
109object Http4sServer extends IOApp {
1110
1211 // Start OBP relevant objects and settings; this step MUST be executed first
1312 // new bootstrap.http4s.Http4sBoot().boot
1413 new bootstrap.liftweb.Boot ().boot
15-
16- // Parse hostname - support both "127.0.0.1" and "http://127.0.0.1" formats
17- private def parseHostname (hostnameValue : String ): String = {
18- val trimmed = hostnameValue.trim
19- // Try to parse as URI first
20- Uri .fromString(trimmed).toOption
21- .flatMap(_.host.map(_.renderString))
22- .getOrElse(trimmed) // If not a valid URI, use as-is
23- }
24-
25- val host = parseHostname(code.api.Constant .HostName )
14+
15+ // Get bind address: use bind_address prop if set, otherwise parse from hostname
16+ // Note: hostname prop must remain unchanged as it may be used for local_provider_name fallback
17+ val host = Http4sConfigUtil .parseHostname(APIUtil .getPropsValue(" bind_address" ,code.api.Constant .HostName ))
2618 val port = APIUtil .getPropsAsIntValue(" dev.port" ,8080 )
2719
2820 // Use shared httpApp configuration (same as tests)
2921 val httpApp = Http4sApp .httpApp
30-
22+
3123 override def run (args : List [String ]): IO [ExitCode ] = EmberServerBuilder
3224 .default[IO ]
3325 .withHost(Host .fromString(host).get)
0 commit comments