40 lines
No EOL
1.6 KiB
Python
40 lines
No EOL
1.6 KiB
Python
import os
|
|
import sys
|
|
import ruamel.yaml
|
|
|
|
yaml = ruamel.yaml.YAML()
|
|
with open("pluGET_config.yaml", "r") as config_file:
|
|
data = yaml.load(config_file)
|
|
|
|
# Connection (local, sftp, ftp)
|
|
if "CONNECTION" in os.environ:
|
|
data['Connection'] = os.environ["CONNECTION"]
|
|
|
|
# LOCAL
|
|
if "LOCAL_PLUGIN_FOLDER" in os.environ:
|
|
data['Local']['PathToPluginFolder'] = os.environ["LOCAL_PLUGIN_FOLDER"]
|
|
if "LOCAL_ENABLE_SEPERATE_DOWNLOAD_PATH" in os.environ:
|
|
data['Local']['SeperateDownloadPath'] = os.environ[""]
|
|
if "LOCAL_SEPERATE_DOWNLOAD_PATH" in os.environ:
|
|
data['Local']['PathToSeperateDownloadPath'] = os.environ["LOCAL_SEPERATE_DOWNLOAD_PATH"]
|
|
|
|
# REMOTE
|
|
if "REMOTE_SERVER" in os.environ:
|
|
data['Remote']['Server'] = os.environ["REMOTE_SERVER"]
|
|
if "REMOTE_USERNAME" in os.environ:
|
|
data['Remote']['Username'] = os.environ["REMOTE_USERNAME"]
|
|
if "REMOTE_PASSWORD" in os.environ:
|
|
data['Remote']['Password'] = os.environ["REMOTE_PASSWORD"]
|
|
if "REMOTE_SFTP_PORT" in os.environ:
|
|
data['Remote']['SFTP_Port'] = os.environ["REMOTE_SFTP_PORT"]
|
|
if "REMOTE_FTP_PORT" in os.environ:
|
|
data['Remote']['FTP_Port'] = os.environ["REMOTE_FTP_PORT"]
|
|
if "REMOTE_PLUGIN_FOLDER" in os.environ:
|
|
data['Remote']['PluginFolderOnServer'] = os.environ["REMOTE_PLUGIN_FOLDER"]
|
|
if "REMOTE_ENABLE_SEPERATE_DOWNLOAD_PATH" in os.environ:
|
|
data['Remote']['SeperateDownloadPath'] = os.environ["REMOTE_ENABLE_SEPERATE_DOWNLOAD_PATH"]
|
|
if "REMOTE_SEPERATE_DOWNLOAD_PATH" in os.environ:
|
|
data['Remote']['PathToSeperateDownloadPath'] = os.environ["REMOTE_SEPERATE_DOWNLOAD_PATH"]
|
|
|
|
with open("pluGET_config.yaml", "w") as config_file:
|
|
yaml.dump(data, config_file) |