diff --git a/.github/Dockerfile_PreBuild b/.github/Dockerfile_PreBuild index 61c37dce74..11588d5ce9 100644 --- a/.github/Dockerfile_PreBuild +++ b/.github/Dockerfile_PreBuild @@ -1,7 +1,7 @@ FROM gcr.io/distroless/java:11 # Copy OBP source code -# Copy build artifact (.war file) into jetty from 'maven' stage. -COPY /obp-http4s-runner/target/obp-http4s-runner.jar /app/obp-http4s-runner.jar +# Copy build artifact (JAR file) from maven build +COPY /obp-api/target/obp-api.jar /app/obp-api.jar WORKDIR /app -CMD ["obp-http4s-runner.jar"] \ No newline at end of file +CMD ["obp-api.jar"] \ No newline at end of file diff --git a/.github/workflows/build_container.yml b/.github/workflows/build_container.yml index 2c5fdd0a4a..3329c22773 100644 --- a/.github/workflows/build_container.yml +++ b/.github/workflows/build_container.yml @@ -111,7 +111,7 @@ jobs: continue-on-error: true run: | mkdir -p ./push - cp obp-http4s-runner/target/obp-http4s-runner.jar ./push/ + cp obp-api/target/obp-api.jar ./push/ - uses: actions/upload-artifact@v4 with: name: ${{ github.sha }} diff --git a/.github/workflows/build_pull_request.yml b/.github/workflows/build_pull_request.yml index 5fc4a74074..79591235d4 100644 --- a/.github/workflows/build_pull_request.yml +++ b/.github/workflows/build_pull_request.yml @@ -114,7 +114,7 @@ jobs: - name: Save .jar artifact run: | mkdir -p ./pull - cp obp-http4s-runner/target/obp-http4s-runner.jar ./pull/ + cp obp-api/target/obp-api.jar ./pull/ - uses: actions/upload-artifact@v4 with: name: ${{ github.sha }} diff --git a/obp-api/src/main/scala/bootstrap/http4s/Http4sServer.scala b/obp-api/src/main/scala/bootstrap/http4s/Http4sServer.scala index 4a006f58ee..6298630950 100644 --- a/obp-api/src/main/scala/bootstrap/http4s/Http4sServer.scala +++ b/obp-api/src/main/scala/bootstrap/http4s/Http4sServer.scala @@ -4,6 +4,7 @@ import cats.effect._ import code.api.util.APIUtil import code.api.util.http4s.Http4sApp import com.comcast.ip4s._ +import org.http4s.Uri import org.http4s.ember.server._ object Http4sServer extends IOApp { @@ -12,7 +13,16 @@ object Http4sServer extends IOApp { // new bootstrap.http4s.Http4sBoot().boot new bootstrap.liftweb.Boot().boot - val host = APIUtil.getPropsValue("hostname","127.0.0.1") + // Parse hostname - support both "127.0.0.1" and "http://127.0.0.1" formats + private def parseHostname(hostnameValue: String): String = { + val trimmed = hostnameValue.trim + // Try to parse as URI first + Uri.fromString(trimmed).toOption + .flatMap(_.host.map(_.renderString)) + .getOrElse(trimmed) // If not a valid URI, use as-is + } + + val host = parseHostname(code.api.Constant.HostName) val port = APIUtil.getPropsAsIntValue("dev.port",8080) // Use shared httpApp configuration (same as tests)