From 447a8a70c557b3ec1033669850e0741461fb5098 Mon Sep 17 00:00:00 2001 From: ruanshudong Date: Sun, 12 Nov 2023 15:23:15 +0800 Subject: [PATCH] tarsnode add nodename to template --- NodeServer/CommandLoad.cpp | 1 + NodeServer/NodeServer.cpp | 2 +- deploy/framework/sql/template/tars.default | 2 ++ tarscpp | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NodeServer/CommandLoad.cpp b/NodeServer/CommandLoad.cpp index 57590e5..3a6a4dc 100644 --- a/NodeServer/CommandLoad.cpp +++ b/NodeServer/CommandLoad.cpp @@ -465,6 +465,7 @@ int CommandLoad::updateConfigFile(string& sResult) mMacro["modulename"] = _desc.application + "." + _desc.serverName; mMacro["app"] = _desc.application; mMacro["server"] = _desc.serverName; + mMacro["nodename"] = PlatformInfo().getNodeName(); mMacro["serverid"] = _serverObjectPtr->getServerId(); mMacro["localip"] = g_app.getAdapterEndpoint("ServerAdapter").getHost(); mMacro["exe"] = TC_File::simplifyDirectory(_exeFile); diff --git a/NodeServer/NodeServer.cpp b/NodeServer/NodeServer.cpp index b411cef..426c6d5 100644 --- a/NodeServer/NodeServer.cpp +++ b/NodeServer/NodeServer.cpp @@ -443,7 +443,7 @@ int NodeServer::onUpdateConfig(const string &nodeId, const string &sConfigFile, sTemplate = TC_Common::replace(sTemplate, "${logpath}", config.get("/tars/application/server", "tars")); sTemplate = TC_Common::replace(sTemplate, "${localip}",sLocalIp); sTemplate = TC_Common::replace(sTemplate, "${local}", config.get("/tars/application/server", "")); - sTemplate = TC_Common::replace(sTemplate, "${modulename}", "tars.tarsnode"); + sTemplate = TC_Common::replace(sTemplate, "${nodename}", config.get("/tars/application/server", "")); // cout << TC_Common::outfill("", '-') << endl; diff --git a/deploy/framework/sql/template/tars.default b/deploy/framework/sql/template/tars.default index 4be2a81..1939a6e 100644 --- a/deploy/framework/sql/template/tars.default +++ b/deploy/framework/sql/template/tars.default @@ -30,6 +30,8 @@ app = ${app} #server name server = ${server} + #node name + nodename = ${nodename} #local ip localip = ${localip} #local endpoint, for tars-node comunication(optional) diff --git a/tarscpp b/tarscpp index d41c825..79190bc 160000 --- a/tarscpp +++ b/tarscpp @@ -1 +1 @@ -Subproject commit d41c825c20211b139f6771276f64d6682ac6fc00 +Subproject commit 79190bc7a847e8d431bccf65f86a7a1cc93ddf9b