Skip to content

Commit

Permalink
fix(cmd-api-server): cockpit off by default hyperledger-cacti#1239
Browse files Browse the repository at this point in the history
Signed-off-by: AzaharaC <[email protected]>
  • Loading branch information
AzaharaC committed Sep 8, 2021
1 parent d715c67 commit e43ee12
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
4 changes: 1 addition & 3 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,7 @@ npm run start:api-server
```

After starting the API server, you will see in the logs that plugins were loaded
and that the API is reachable on the port you specified (4000 by default) and
the Web UI (Cockpit) is reachable through port on the port your config
specified (3000 by default).
and that the API is reachable on the port you specified (4000 by default).

> You may need to enable manually the CORS patterns in the configuration file.
This may be slightly inconvenient, but something we are unable to compromise on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class ApiServer {
tls.DEFAULT_MAX_VERSION = tlsMaxVersion;

try {
const { cockpitTlsEnabled, apiTlsEnabled } = this.options.config;
const { apiTlsEnabled } = this.options.config;
const addressInfoCockpit = await this.startCockpitFileServer();
const addressInfoApi = await this.startApiServer();
const addressInfoGrpc = await this.startGrpcServer();
Expand All @@ -205,14 +205,6 @@ export class ApiServer {
this.log.info(`Cactus API reachable ${httpUrl}`);
}

{
const { cockpitHost: host } = this.options.config;
const { port } = addressInfoCockpit;
const protocol = cockpitTlsEnabled ? "https:" : "http:";
const httpUrl = `${protocol}//${host}:${port}`;
this.log.info(`Cactus Cockpit reachable ${httpUrl}`);
}

return { addressInfoCockpit, addressInfoApi, addressInfoGrpc };
} catch (ex) {
const errorMessage = `Failed to start ApiServer: ${ex.stack}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,6 @@ export class ConfigService {
],
};

const cockpitTlsEnabled = (schema.cockpitTlsEnabled as SchemaObj).default;
const cockpitHost = (schema.cockpitHost as SchemaObj).default;
const cockpitPort = (schema.cockpitPort as SchemaObj).default;

Expand Down Expand Up @@ -572,7 +571,7 @@ export class ConfigService {
cockpitWwwRoot: (schema.cockpitWwwRoot as SchemaObj).default,
cockpitCorsDomainCsv: (schema.cockpitCorsDomainCsv as SchemaObj).default,
cockpitMtlsEnabled: false,
cockpitTlsEnabled,
cockpitTlsEnabled: false,
cockpitTlsCertPem: pkiServer.certificatePem,
cockpitTlsKeyPem: pkiServer.privateKeyPem,
cockpitTlsClientCaPem: "-", // Cockpit mTLS is off so this will not crash the server
Expand Down

0 comments on commit e43ee12

Please sign in to comment.