diff --git a/init_container.py b/init_container.py index 319082f..14d7b0d 100644 --- a/init_container.py +++ b/init_container.py @@ -5,22 +5,31 @@ def copy_configs(): src_directory = "/data/config-tmp/" dest_directory = "/data/config/" - files = os.listed(src_directory) + files = os.listdir(src_directory) + for file in files: src_path = os.path.join(src_directory, file) dest_path = os.path.join(dest_directory, file) + + # Check if the destination file exists and remove it + if os.path.exists(dest_path): + os.remove(dest_path) + + # Move the file from src to dest shutil.move(src_path, dest_path) + print(f"Copied configuration files from {src_directory} to {dest_directory}") def install_plugins(): plugin_directory = "/data/plugins/" plugin_urls = os.getenv("PLUGIN_URLS", "") + if not plugin_urls: print("No PLUGIN_URLS environment variable set.") return # Ensure the plugins directory exists - os.makers(plugin_directory, exist_ok=True) + os.makedirs(plugin_directory, exist_ok=True) # Download each plugin from the provided URLs for url in plugin_urls.split(','):