keeps default dev config unchanged.

this commit moves the default config into a seperate folder.
And it adds a preLaunchTask
which copies the default dev config to the used dev config.
This is done with the cp option '-ru'
so if the files in the target dir (current config)
are newer they are not overwritten.
This commit is contained in:
prash3r 2022-09-14 19:04:58 +02:00
parent f924e1a683
commit 706bbac9f0
17 changed files with 24 additions and 2 deletions

3
.vscode/launch.json vendored
View file

@ -10,7 +10,8 @@
"type": "python", "type": "python",
"request": "launch", "request": "launch",
"module": "run", "module": "run",
"args": ["--config-folder-path=./.devcontainer/cbpi-dev-config", "start"] "args": ["--config-folder-path=./.devcontainer/cbpi-dev-config", "start"],
"preLaunchTask": "copy default cbpi config files if dev config files dont exist"
}, },
{ {

20
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,20 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "copy default cbpi config files if dev config files dont exist",
"type": "shell",
"command": "cp -ru ${workspaceFolder}/.devcontainer/cbpi-default-dev-config/. ${workspaceFolder}/.devcontainer/cbpi-dev-config",
"windows": {
"command": "echo 'this pre debug task should only be run inside the docker dev container - doing nothing instead'"
},
"group": "build",
"presentation": {
"reveal": "silent",
"panel": "shared"
}
}
]
}

View file

@ -14,7 +14,8 @@ class ConfigFolder:
def __init__(self, configFolderPath, logsFolderPath): def __init__(self, configFolderPath, logsFolderPath):
self.configFolderPath = configFolderPath self.configFolderPath = configFolderPath
self.logsFolderPath = logsFolderPath self.logsFolderPath = logsFolderPath
self.logger.info("Config folder path : " + os.path.join(Path(self.cbpi.config_folder.configFolderPath).absolute())) print("config folder path : " + configFolderPath)
print("logs folder path : " + logsFolderPath)
def config_file_exists(self, path): def config_file_exists(self, path):
return os.path.exists(self.get_file_path(path)) return os.path.exists(self.get_file_path(path))