Skip to content

Commit 1c79126

Browse files
committed
[core] config source_core_dir and target_core_dir
1 parent 0576320 commit 1c79126

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

internal/configure/topology/dc_get.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ func (dc *DeployConfig) GetReportUsage() bool { return dc.getBool(CONFIG_
131131
func (dc *DeployConfig) GetContainerImage() string { return dc.getString(CONFIG_CONTAINER_IMAGE) }
132132
func (dc *DeployConfig) GetLogDir() string { return dc.getString(CONFIG_LOG_DIR) }
133133
func (dc *DeployConfig) GetDataDir() string { return dc.getString(CONFIG_DATA_DIR) }
134-
func (dc *DeployConfig) GetCoreDir() string { return dc.getString(CONFIG_CORE_DIR) }
134+
func (dc *DeployConfig) GetSourceCoreDir() string { return dc.getString(CONFIG_SOURCE_CORE_DIR) }
135+
func (dc *DeployConfig) GetTargetCoreDir() string { return dc.getString(CONFIG_TARGET_CORE_DIR) }
135136
func (dc *DeployConfig) GetEnv() string { return dc.getString(CONFIG_ENV) }
136137
func (dc *DeployConfig) GetListenIp() string { return dc.getString(CONFIG_LISTEN_IP) }
137138
func (dc *DeployConfig) GetListenPort() int { return dc.getInt(CONFIG_LISTEN_PORT) }

internal/configure/topology/dc_item.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,15 @@ var (
124124
nil,
125125
)
126126

127-
CONFIG_CORE_DIR = itemset.insert(
128-
"core_dir",
127+
CONFIG_SOURCE_CORE_DIR = itemset.insert(
128+
"source_core_dir",
129+
REQUIRE_STRING,
130+
true,
131+
nil,
132+
)
133+
134+
CONFIG_TARGET_CORE_DIR = itemset.insert(
135+
"target_core_dir",
129136
REQUIRE_STRING,
130137
true,
131138
nil,

internal/task/task/checker/common.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,20 @@ func getServiceDirectorys(dc *topology.DeployConfig) []Directory {
174174
dirs := []Directory{}
175175
logDir := dc.GetLogDir()
176176
dataDir := dc.GetDataDir()
177-
coreDir := dc.GetCoreDir()
177+
sourceCoreDir := dc.GetSourceCoreDir()
178+
targetCoreDir := dc.GetTargetCoreDir()
178179

179180
if len(logDir) > 0 {
180181
dirs = append(dirs, Directory{LOG_DIR, logDir})
181182
}
182183
if len(dataDir) > 0 {
183184
dirs = append(dirs, Directory{DATA_DIR, dataDir})
184185
}
185-
if len(coreDir) > 0 {
186-
dirs = append(dirs, Directory{CORE_DIR, coreDir})
186+
if len(sourceCoreDir) > 0 {
187+
dirs = append(dirs, Directory{CORE_DIR, sourceCoreDir})
188+
}
189+
if len(targetCoreDir) > 0 {
190+
dirs = append(dirs, Directory{CORE_DIR, targetCoreDir})
187191
}
188192

189193
return dirs

internal/task/task/common/create_container.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ func getMountVolumes(dc *topology.DeployConfig) []step.Volume {
168168
layout := dc.GetProjectLayout()
169169
logDir := dc.GetLogDir()
170170
dataDir := dc.GetDataDir()
171-
coreDir := dc.GetCoreDir()
171+
sourceCoreDir := dc.GetSourceCoreDir()
172+
targetCoreDir := dc.GetTargetCoreDir()
172173

173174
if len(logDir) > 0 {
174175
volumes = append(volumes, step.Volume{
@@ -184,10 +185,10 @@ func getMountVolumes(dc *topology.DeployConfig) []step.Volume {
184185
})
185186
}
186187

187-
if len(coreDir) > 0 {
188+
if len(targetCoreDir) > 0 {
188189
volumes = append(volumes, step.Volume{
189-
HostPath: coreDir,
190-
ContainerPath: layout.CoreSystemDir,
190+
HostPath: targetCoreDir,
191+
ContainerPath: sourceCoreDir,
191192
})
192193
}
193194

0 commit comments

Comments
 (0)