EG-1557 - Configuration data from "include" section ignored while command line contains the path to config file without leading ./ (#6354)

Configuration data from "include" section ignored while command line contains the path to config file without leading ./
This commit is contained in:
pnemeth 2020-06-19 10:32:55 +01:00 committed by GitHub
parent 71b2a43221
commit d6cab0e131
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View File

@ -34,7 +34,7 @@ open class SharedNodeCmdLineOptions {
description = ["The path to the config file. By default this is node.conf in the base directory."]
)
private var _configFile: Path? = null
val configFile: Path get() = _configFile ?: (baseDirectory / "node.conf")
val configFile: Path get() = if (_configFile != null) baseDirectory.resolve(_configFile) else (baseDirectory / "node.conf")
@Option(
names = ["--on-unknown-config-keys"],

View File

@ -22,7 +22,7 @@ class NodeStartupCliTest {
companion object {
private lateinit var workingDirectory: Path
private var customNodeConf = "custom_node.conf"
@BeforeClass
@JvmStatic
fun initDirectories() {
@ -56,6 +56,18 @@ class NodeStartupCliTest {
Assertions.assertThat(startup.cmdLineOptions.networkRootTrustStorePathParameter).isEqualTo(null)
}
@Test(timeout=300_000)
fun `--nodeconf using relative path will be changed to absolute path`() {
CommandLine.populateCommand(startup, CommonCliConstants.CONFIG_FILE, customNodeConf)
Assertions.assertThat(startup.cmdLineOptions.configFile).isEqualTo(workingDirectory / customNodeConf)
}
@Test(timeout=300_000)
fun `--nodeconf using absolute path will not be changed`() {
CommandLine.populateCommand(startup, CommonCliConstants.CONFIG_FILE, "/$customNodeConf")
Assertions.assertThat(startup.cmdLineOptions.configFile).isEqualTo( "/" / customNodeConf)
}
@Test(timeout=3_000)
@Ignore
fun `test logs are written to correct location correctly if verbose flag set`() {

View File

@ -211,6 +211,7 @@ fun printError(message: String) = System.err.println("${ShellConstants.RED}$mess
*/
object CommonCliConstants {
const val BASE_DIR = "--base-directory"
const val CONFIG_FILE = "--config-file"
}
/**