Skip to content
Snippets Groups Projects
Commit 6b1d7c35 authored by Benguria Elguezabal, Gorka's avatar Benguria Elguezabal, Gorka
Browse files

extract urls to config.json

parent ec63f74f
No related branches found
No related tags found
No related merge requests found
Showing
with 82 additions and 44 deletions
...@@ -36,5 +36,8 @@ ENV DASHBOARD_BASE_URL=http://localhost:4200 \ ...@@ -36,5 +36,8 @@ ENV DASHBOARD_BASE_URL=http://localhost:4200 \
BUS_OD_API_BASE_URL=http://localhost:8000/busesod \ BUS_OD_API_BASE_URL=http://localhost:8000/busesod \
BIKETRAJECTORY_API_BASE_URL=http://localhost:8000/urbanite_biketrajectories \ BIKETRAJECTORY_API_BASE_URL=http://localhost:8000/urbanite_biketrajectories \
NOISECOMPUTATION_API_BASE_URL=http://localhost:8002/urbanite_noise_computation \ NOISECOMPUTATION_API_BASE_URL=http://localhost:8002/urbanite_noise_computation \
ODFROMCOUNTS_API_BASE_URL=http://localhost:8015/odfromcounts ODFROMCOUNTS_API_BASE_URL=http://localhost:8015/odfromcounts \
TRAFFIC_SIMULATION_BASE_URL=http://localhost:8082/traffic-simulation \
TRAFFIC_SIMULATION_STORAGE_URL=http://localhost:8081 \
TRAFFIC_SIMULATION_DSS_URL=http://localhost:8083 \
TRAFFIC_SIMULATION_STOMP_URL=ws://localhost:8082/gs-guide-websocket
...@@ -22,3 +22,7 @@ sed -i -e "s|__BIKETRAJECTORY_API_BASE_URL__|$BIKETRAJECTORY_API_BASE_URL|g" $FI ...@@ -22,3 +22,7 @@ sed -i -e "s|__BIKETRAJECTORY_API_BASE_URL__|$BIKETRAJECTORY_API_BASE_URL|g" $FI
sed -i -e "s|__DEFAULT_PILOT__|$DEFAULT_PILOT|g" $FILE sed -i -e "s|__DEFAULT_PILOT__|$DEFAULT_PILOT|g" $FILE
sed -i -e "s|__NOISECOMPUTATION_API_BASE_URL__|$NOISECOMPUTATION_API_BASE_URL|g" $FILE sed -i -e "s|__NOISECOMPUTATION_API_BASE_URL__|$NOISECOMPUTATION_API_BASE_URL|g" $FILE
sed -i -e "s|__ODFROMCOUNTS_API_BASE_URL__|$ODFROMCOUNTS_API_BASE_URL|g" $FILE sed -i -e "s|__ODFROMCOUNTS_API_BASE_URL__|$ODFROMCOUNTS_API_BASE_URL|g" $FILE
sed -i -e "s|__TRAFFIC_SIMULATION_BASE_URL__|$TRAFFIC_SIMULATION_BASE_URL|g" $FILE
sed -i -e "s|__TRAFFIC_SIMULATION_STORAGE_URL__|$TRAFFIC_SIMULATION_STORAGE_URL|g" $FILE
sed -i -e "s|__TRAFFIC_SIMULATION_DSS_URL__|$TRAFFIC_SIMULATION_DSS_URL|g" $FILE
sed -i -e "s|__TRAFFIC_SIMULATION_STOMP_URL__|$TRAFFIC_SIMULATION_STOMP_URL|g" $FILE
import { Component, OnInit } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { environment } from "../../../../environments/environment"; import { environment } from "../../../../environments/environment";
import { ConfigService } from '@ngx-config/core';
@Component({ @Component({
selector: "ngx-ml-module", selector: "ngx-ml-module",
...@@ -7,10 +8,15 @@ import { environment } from "../../../../environments/environment"; ...@@ -7,10 +8,15 @@ import { environment } from "../../../../environments/environment";
styleUrls: ["./ml-module.component.scss"], styleUrls: ["./ml-module.component.scss"],
}) })
export class MlModuleComponent implements OnInit { export class MlModuleComponent implements OnInit {
constructor() {} constructor(
private configService: ConfigService
) {
this.storage_url = `${configService.getSettings("traffic_simulation_storage_url")}`;
this.file_url = `${configService.getSettings("traffic_simulation_storage_url")}/ml-experiments`;
}
storage_url = `${environment.storageAPIUrl}`; storage_url: any;
file_url = this.storage_url + "/ml-experiments"; file_url: any;
visualizationBtnDisabled: boolean = true; visualizationBtnDisabled: boolean = true;
mlBtnDisabled: boolean = true; mlBtnDisabled: boolean = true;
recommendationBtnDisabled: boolean = true; recommendationBtnDisabled: boolean = true;
......
...@@ -48,11 +48,20 @@ import { MlModuleComponent } from "./ml-module/ml-module.component"; ...@@ -48,11 +48,20 @@ import { MlModuleComponent } from "./ml-module/ml-module.component";
import { VisualizationsGeojsonComponent } from "./visualizations/visualizations-geojson/visualizations-geojson.component"; import { VisualizationsGeojsonComponent } from "./visualizations/visualizations-geojson/visualizations-geojson.component";
import { RecommenderPageComponent } from "./recommender-page/recommender-page.component"; import { RecommenderPageComponent } from "./recommender-page/recommender-page.component";
import { EditNetworkMapComponent } from "./edit-network-map/edit-network-map.component"; import { EditNetworkMapComponent } from "./edit-network-map/edit-network-map.component";
import { ConfigService } from '@ngx-config/core';
const rxStompConfig: InjectableRxStompConfig = { export class MyRxStompConfig extends InjectableRxStompConfig {
brokerURL: environment.baseStompURL, constructor(private configService: ConfigService) {
debug: (msg) => environment.showWebSocketDebug && console.debug(msg), super();
this.brokerURL = `${configService.getSettings("traffic_simulation_stomp_url")}`;
this.heartbeatIncoming = 0;
this.heartbeatOutgoing = 10000;
this.reconnectDelay = 500;
this.debug = (msg: string): void => {
environment.showWebSocketDebug && console.debug(msg);
}; };
}
}
@NgModule({ @NgModule({
imports: [ imports: [
...@@ -102,7 +111,8 @@ const rxStompConfig: InjectableRxStompConfig = { ...@@ -102,7 +111,8 @@ const rxStompConfig: InjectableRxStompConfig = {
providers: [ providers: [
{ {
provide: InjectableRxStompConfig, provide: InjectableRxStompConfig,
useValue: rxStompConfig, useClass: MyRxStompConfig,
deps: [ConfigService]
}, },
{ {
provide: RxStompService, provide: RxStompService,
......
...@@ -7,15 +7,19 @@ import { City } from "../data/city"; ...@@ -7,15 +7,19 @@ import { City } from "../data/city";
import { Network } from "../data/network"; import { Network } from "../data/network";
import { Scenario } from "../data/scenario"; import { Scenario } from "../data/scenario";
import { tapDebugApi } from "./tap-debug"; import { tapDebugApi } from "./tap-debug";
import { ConfigService } from '@ngx-config/core';
@Injectable({ providedIn: "root" }) @Injectable({ providedIn: "root" })
export class CityService { export class CityService {
private url = `${environment.baseAPIUrl}/traffic-simulation/city`; private url: any;
private selectedCityIndex: number; private selectedCityIndex: number;
private selectedCity$ = new BehaviorSubject<City | null>(null); private selectedCity$ = new BehaviorSubject<City | null>(null);
cities: City[]; cities: City[];
constructor(private httpClient: HttpClient) {} constructor(
private httpClient: HttpClient,
private configService: ConfigService
) { this.url = `${configService.getSettings("traffic_simulation_base_url")}/city`; }
public setSelectedCity(cityId: string) { public setSelectedCity(cityId: string) {
this.selectedCityIndex = this.cities.findIndex( this.selectedCityIndex = this.cities.findIndex(
......
...@@ -4,14 +4,18 @@ import { Observable } from "rxjs"; ...@@ -4,14 +4,18 @@ import { Observable } from "rxjs";
import { tap } from "rxjs/operators"; import { tap } from "rxjs/operators";
import { Simulation } from "../data/simulation"; import { Simulation } from "../data/simulation";
import { environment } from "../../../../../environments/environment"; import { environment } from "../../../../../environments/environment";
import { ConfigService } from '@ngx-config/core';
@Injectable({ @Injectable({
providedIn: "root", providedIn: "root",
}) })
export class ComService { export class ComService {
private traffic_sim_server = `${environment.baseAPIUrl}/traffic-simulation/network`; private traffic_sim_server: any;
constructor(private http: HttpClient) {} constructor(
private http: HttpClient,
private configService: ConfigService
) { this.traffic_sim_server = `${configService.getSettings("traffic_simulation_base_url")}/network`; }
sendGetResultsVis(simId: number): Observable<any> { sendGetResultsVis(simId: number): Observable<any> {
const url: string = `${this.traffic_sim_server}/simulation/${simId}/results/vis-trips`; const url: string = `${this.traffic_sim_server}/simulation/${simId}/results/vis-trips`;
......
...@@ -8,14 +8,18 @@ import { map, catchError } from "rxjs/operators"; ...@@ -8,14 +8,18 @@ import { map, catchError } from "rxjs/operators";
import { environment } from "../../../../../environments/environment"; import { environment } from "../../../../../environments/environment";
import { Network } from "../data/network"; import { Network } from "../data/network";
import { tapDebugApi } from "./tap-debug"; import { tapDebugApi } from "./tap-debug";
import { ConfigService } from '@ngx-config/core';
@Injectable({ @Injectable({
providedIn: "root", providedIn: "root",
}) })
export class NetworkService { export class NetworkService {
private baseAPIUrl = `${environment.baseAPIUrl}/traffic-simulation/network`; private baseAPIUrl: any;
constructor(private httpClient: HttpClient) {} constructor(
private httpClient: HttpClient,
private configService: ConfigService
) { this.baseAPIUrl = `${configService.getSettings("traffic_simulation_base_url")}/network`; }
handleError(error: HttpErrorResponse) { handleError(error: HttpErrorResponse) {
let errorMessage = "Some sort of error."; let errorMessage = "Some sort of error.";
......
...@@ -6,14 +6,18 @@ import { environment } from "../../../../../environments/environment"; ...@@ -6,14 +6,18 @@ import { environment } from "../../../../../environments/environment";
import { Scenario } from "../data/scenario"; import { Scenario } from "../data/scenario";
import { Simulation } from "../data/simulation"; import { Simulation } from "../data/simulation";
import { tapDebugApi } from "./tap-debug"; import { tapDebugApi } from "./tap-debug";
import { ConfigService } from '@ngx-config/core';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
}) })
export class ScenarioService { export class ScenarioService {
private baseApiUrl = `${environment.baseAPIUrl}/traffic-simulation/scenario`; private baseApiUrl: any;
constructor(private httpClient: HttpClient) { } constructor(
private httpClient: HttpClient,
private configService: ConfigService
) { this.baseApiUrl = `${configService.getSettings("traffic_simulation_base_url")}/scenario`; }
createScenario(scenario: Scenario) { createScenario(scenario: Scenario) {
return this.httpClient.post(this.baseApiUrl, scenario).pipe( return this.httpClient.post(this.baseApiUrl, scenario).pipe(
......
...@@ -5,17 +5,26 @@ import { map, tap, catchError } from "rxjs/operators"; ...@@ -5,17 +5,26 @@ import { map, tap, catchError } from "rxjs/operators";
import { environment } from "../../../../../environments/environment"; import { environment } from "../../../../../environments/environment";
import { Simulation } from "../data/simulation"; import { Simulation } from "../data/simulation";
import { tapDebugApi } from "./tap-debug"; import { tapDebugApi } from "./tap-debug";
import { ConfigService } from '@ngx-config/core';
@Injectable({ @Injectable({
providedIn: "root", providedIn: "root",
}) })
export class SimulationService { export class SimulationService {
private ts_simulation_url = `${environment.baseAPIUrl}/traffic-simulation/simulation`; private ts_simulation_url: any;
private ts_url = `${environment.baseAPIUrl}/traffic-simulation`; private ts_url: any;
private storage_url = `${environment.storageAPIUrl}`; private storage_url: any;
private dssUrl = `${environment.dssUrl}`; private dssUrl: any;
constructor(private httpClient: HttpClient) {} constructor(
private httpClient: HttpClient,
private configService: ConfigService
) {
this.ts_simulation_url = `${configService.getSettings("traffic_simulation_base_url")}/simulation`;
this.ts_url = `${configService.getSettings("traffic_simulation_base_url")}`;
this.storage_url = `${configService.getSettings("traffic_simulation_storage_url")}`;
this.dssUrl = `${configService.getSettings("traffic_simulation_dss_url")}`;
}
createSimulation(simulation: Simulation): Observable<Simulation> { createSimulation(simulation: Simulation): Observable<Simulation> {
return this.httpClient.post(this.ts_simulation_url, simulation).pipe( return this.httpClient.post(this.ts_simulation_url, simulation).pipe(
......
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
"biketrajectory_api_base_url":"__BIKETRAJECTORY_API_BASE_URL__", "biketrajectory_api_base_url":"__BIKETRAJECTORY_API_BASE_URL__",
"bus_od_api_base_url":"__BUS_OD_API_BASE_URL__", "bus_od_api_base_url":"__BUS_OD_API_BASE_URL__",
"idra_base_url":"__IDRA_BASE_URL__", "idra_base_url":"__IDRA_BASE_URL__",
"traffic_simulation_base_url":"__TRAFFIC_SIMULATION_BASE_URL__",
"traffic_simulation_storage_url":"__TRAFFIC_SIMULATION_STORAGE_URL__",
"traffic_simulation_dss_url":"__TRAFFIC_SIMULATION_DSS_URL__",
"traffic_simulation_stomp_url":"__TRAFFIC_SIMULATION_STOMP_URL__",
"idra_portal_base_href":"IdraPortal", "idra_portal_base_href":"IdraPortal",
"enable_datalet":true, "enable_datalet":true,
"datalet_base_url":"__DATALET_BASE_URL__", "datalet_base_url":"__DATALET_BASE_URL__",
......
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
"biketrajectory_api_base_url":"http://localhost:8000/biketrajectories", "biketrajectory_api_base_url":"http://localhost:8000/biketrajectories",
"bus_od_api_base_url":"http://localhost:8000/busesod", "bus_od_api_base_url":"http://localhost:8000/busesod",
"idra_base_url":"http://localhost:8082", "idra_base_url":"http://localhost:8082",
"traffic_simulation_base_url":"http://localhost:8082/traffic-simulation",
"traffic_simulation_storage_url":"http://localhost:8081",
"traffic_simulation_dss_url":"http://localhost:8083",
"traffic_simulation_stomp_url":"ws://localhost:8082/gs-guide-websocket",
"idra_portal_base_href":"IdraPortal", "idra_portal_base_href":"IdraPortal",
"enable_datalet":true, "enable_datalet":true,
"datalet_base_url":"http://localhost/deep/deep-components/creator.html", "datalet_base_url":"http://localhost/deep/deep-components/creator.html",
......
...@@ -5,15 +5,6 @@ ...@@ -5,15 +5,6 @@
*/ */
export const environment = { export const environment = {
production: true, production: true,
baseAPIUrl: 'http://localhost:8082',
storageAPIUrl: 'http://localhost:8081',
baseStompURL: 'ws://localhost:8082/gs-guide-websocket',
dssUrl: 'http://localhost:8083',
showAPIDebug: false, showAPIDebug: false,
showWebSocketDebug: true, showWebSocketDebug: true
ftpHost: '127.0.0.1',
ftpPort: '2121',
ftpUser: 'urbanite',
ftpPassword: 'password',
ftpDirectory: 'data'
}; };
...@@ -10,15 +10,6 @@ ...@@ -10,15 +10,6 @@
export const environment = { export const environment = {
production: false, production: false,
baseAPIUrl: 'http://localhost:8082',
storageAPIUrl: 'http://localhost:8081',
baseStompURL: 'ws://localhost:8082/gs-guide-websocket',
dssUrl: 'http://localhost:8083',
showAPIDebug: false, showAPIDebug: false,
showWebSocketDebug: true, showWebSocketDebug: true
ftpHost: '127.0.0.1',
ftpPort: '2121',
ftpUser: 'urbanite',
ftpPassword: 'password',
ftpDirectory: 'data'
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment