Prerequisites
- spring-boot 1.3.1.RELEASE
- TypeScript 1.8.9
- AngularJs 1.5.3
- Zuul
I have an api gateway which hides a set of microservices. This api gateway uses zuul to map Urls to the different microservices.
zuul:
routes:
service1:
path: /service1/**
serviceId: FIRST-MICROSERVICE
service2:
path: /service2/**
serviceId: SECOND-MICROSERVICE
service3:
path: /service3/**
serviceId: THIRD-MICROSERVICE
Question
I want to be able to start the api gateway on different ports with spring-boot like this:
java -jar -Dserver.port=8081 myspringbootapplication.jar
The host should always be the host from which the angularjs application was delivered.
The problem is that the port depends on the port spring-boot startet the tomcat server.
At the moment http://localhost:9001
is hardcoded.
.factory('app.core.services.myApiResource', ['$resource', '$http',
($resource:ng.resource.IResourceService, $http:ng.IHttpService):ng.resource.IResourceClass<ng.resource.IResource<any>> => {
var apiRoot : ng.resource.IResourceClass<ng.resource.IResource<any>>
= $resource('http://localhost:9001/service1/myentity/search/:finderName');
return apiRoot;
}
])
In bootstrap.yml the default port is 9001
# Default ports
server.port: 9001
Is there a way to set the port value in angularjs $resource to spring-boot server.port value?