Added CLOUD_RPC_PORT and CLOUD_RPC_SSL_ENABLED to the instructions docker-compose file

This commit is contained in:
Volodymyr Babak 2023-01-04 10:53:42 +02:00
parent b87b74a27e
commit fd03d333bd
2 changed files with 11 additions and 0 deletions

View File

@ -46,6 +46,8 @@ services:
CLOUD_ROUTING_KEY: ${CLOUD_ROUTING_KEY} CLOUD_ROUTING_KEY: ${CLOUD_ROUTING_KEY}
CLOUD_ROUTING_SECRET: ${CLOUD_ROUTING_SECRET} CLOUD_ROUTING_SECRET: ${CLOUD_ROUTING_SECRET}
CLOUD_RPC_HOST: ${BASE_URL} CLOUD_RPC_HOST: ${BASE_URL}
CLOUD_RPC_PORT: ${CLOUD_RPC_PORT}
CLOUD_RPC_SSL_ENABLED: ${CLOUD_RPC_SSL_ENABLED}
volumes: volumes:
- ~/.mytb-edge-data:/data - ~/.mytb-edge-data:/data
- ~/.mytb-edge-logs:/var/log/tb-edge - ~/.mytb-edge-logs:/var/log/tb-edge

View File

@ -17,6 +17,7 @@ package org.thingsboard.server.service.edge.instructions;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.thingsboard.server.common.data.edge.Edge; import org.thingsboard.server.common.data.edge.Edge;
@ -45,6 +46,12 @@ public class DefaultEdgeInstallService implements EdgeInstallService {
private final InstallScripts installScripts; private final InstallScripts installScripts;
@Value("${edges.rpc.port}")
private int rpcPort;
@Value("${edges.rpc.ssl.enabled}")
private boolean sslEnabled;
@Override @Override
public EdgeInstallInstructions getDockerInstallInstructions(TenantId tenantId, Edge edge, HttpServletRequest request) { public EdgeInstallInstructions getDockerInstallInstructions(TenantId tenantId, Edge edge, HttpServletRequest request) {
String dockerInstallInstructions = readFile(resolveFile("docker", "instructions.md")); String dockerInstallInstructions = readFile(resolveFile("docker", "instructions.md"));
@ -59,6 +66,8 @@ public class DefaultEdgeInstallService implements EdgeInstallService {
} }
dockerInstallInstructions = dockerInstallInstructions.replace("${CLOUD_ROUTING_KEY}", edge.getRoutingKey()); dockerInstallInstructions = dockerInstallInstructions.replace("${CLOUD_ROUTING_KEY}", edge.getRoutingKey());
dockerInstallInstructions = dockerInstallInstructions.replace("${CLOUD_ROUTING_SECRET}", edge.getSecret()); dockerInstallInstructions = dockerInstallInstructions.replace("${CLOUD_ROUTING_SECRET}", edge.getSecret());
dockerInstallInstructions = dockerInstallInstructions.replace("${CLOUD_RPC_PORT}", Integer.toString(rpcPort));
dockerInstallInstructions = dockerInstallInstructions.replace("${CLOUD_RPC_SSL_ENABLED}", Boolean.toString(sslEnabled));
return new EdgeInstallInstructions(dockerInstallInstructions); return new EdgeInstallInstructions(dockerInstallInstructions);
} }