Simplification of Central System Server configuration
MODIFY
docker/config.json
docker/config.json
"protocol": "http",
"host": "server",
"port": 9090,
- "debug": false,
- "externalProtocol": "http"
+ "debug": false
},
"ODataService": {
"protocol": "http",
"host": "server",
"port": 9292,
- "debug": false,
- "externalProtocol": "http"
+ "debug": false
},
"WSDLEndpoint": {
"baseUrl": "http://server:8000"

MODIFY
src/assets/config-template-http.json
src/assets/config-template-http.json
"protocol": "http",
"host": "localhost",
"port": 9090,
- "debug": false,
- "externalProtocol": "http"
+ "debug": false
},
"OICPService": {
"protocol": "http",
"host": "localhost",
"port": 9080,
- "debug": false,
- "externalProtocol": "http"
+ "debug": false
},
"CentralSystemServer": {
"protocol": "http",
"protocol": "http",
"host": "localhost",
"port": 9292,
- "debug": false,
- "externalProtocol": "http"
+ "debug": false
},
"WSDLEndpoint": {
"baseSecureUrl": ""

MODIFY
src/assets/config-template-https.json
src/assets/config-template-https.json
"sslKey": "",
"sslCert": "",
"sslCa": [],
- "debug": false,
- "externalProtocol": "https"
+ "debug": false
},
"OICPService": {
"protocol": "https",
"sslCa": [
"**insert certificate in PEM format**"
],
- "debug": false,
- "externalProtocol": "https"
+ "debug": false
},
"CentralSystemServer": {
"protocol": "https",
"sslKey": "",
"sslCert": "",
"sslCa": [],
- "debug": false,
- "externalProtocol": "https"
+ "debug": false
},
"WSDLEndpoint": {
"baseSecureUrl": ""

MODIFY
src/assets/schemas/configuration/configuration.json
src/assets/schemas/configuration/configuration.json
},
"debug": {
"type": "boolean"
- },
- "externalProtocol": {
- "type": "string"
}
},
"required": [
"protocol",
"host",
"port",
- "debug",
- "externalProtocol"
+ "debug"
]
},
"ODataService": {
"port": {
"type": "integer"
},
- "externalProtocol": {
- "type": "string"
- },
"debug": {
"type": "boolean"
}
"protocol",
"host",
"port",
- "externalProtocol",
"debug"
]
},

MODIFY
src/server/ServerUtils.ts
src/server/ServerUtils.ts
@@ -6,7 +6,6 @@ import CentralSystemServerConfiguration from '../types/configuration/CentralSyst
import Constants from '../utils/Constants';
import Logging from '../utils/Logging';
import { StatusCodes } from 'http-status-codes';
-import Utils from '../utils/Utils';
import https from 'https';
export class ServerUtils {
@@ -30,22 +29,6 @@ export class ServerUtils {
if (serverConfig.protocol === ServerProtocol.HTTPS || serverConfig.protocol === ServerProtocol.WSS) {
// Create the options
const options: https.ServerOptions = {};
- // Intermediate cert?
- if (serverConfig.sslCa) {
- // Array?
- if (!Utils.isEmptyArray(serverConfig.sslCa)) {
- options.ca = [];
- // Add all
- for (const sslCa of serverConfig.sslCa) {
- if (sslCa) {
- options.ca.push(sslCa);
- }
- }
- } else {
- // Add one
- options.ca = serverConfig.sslCa;
- }
- }
// Https server
httpServer = https.createServer(options, requestListener);
} else {

MODIFY
src/server/ocpi/AbstractOCPIService.ts
src/server/ocpi/AbstractOCPIService.ts
@@ -50,11 +50,10 @@ export default abstract class AbstractOCPIService {
}
public getBaseUrl(req: Request): string {
- const protocol = (this.ocpiRestConfig.externalProtocol ? this.ocpiRestConfig.externalProtocol : 'https');
// Get host from the req
const host = req.get('host');
// Return Service url
- return `${protocol}://${host}`;
+ return `https://${host}`;
}
public getPath(): string {

MODIFY
src/server/oicp/AbstractOICPService.ts
src/server/oicp/AbstractOICPService.ts
@@ -47,11 +47,10 @@ export default abstract class AbstractOICPService {
}
public getBaseUrl(req: Request): string {
- const protocol = (this.oicpRestConfig.externalProtocol ? this.oicpRestConfig.externalProtocol : 'https');
// Get host from the req
const host = req.get('host');
// Return Service url
- return `${protocol}://${host}`;
+ return `https://${host}`;
}
public getPath(): string {

MODIFY
src/types/configuration/CentralSystemServerConfiguration.ts
src/types/configuration/CentralSystemServerConfiguration.ts
@@ -2,10 +2,6 @@ import { ServerProtocol } from '../Server';
export default interface CentralSystemServerConfiguration {
protocol: ServerProtocol;
- externalProtocol?: ServerProtocol;
host?: string;
port: number;
- sslKey?: string;
- sslCert?: string;
- sslCa?: string | string[];
}

Simplification of Central System Server configuration