import yaml import sys with open('appwrite-coolify.yml', 'r') as f: data = yaml.safe_load(f) env_list = data['services']['openruntimes-executor']['environment'] if isinstance(env_list, list): new_env = {} for item in env_list: if '=' in item: k, v = item.split('=', 1) # Remove the quotes that we added earlier if k == '"OPR_EXECUTOR_RUNTIMES' and v.endswith('"'): k = 'OPR_EXECUTOR_RUNTIMES' v = v[:-1] new_env[k] = v data['services']['openruntimes-executor']['environment'] = new_env with open('appwrite-coolify.yml', 'w') as f: yaml.dump(data, f, default_flow_style=False, sort_keys=False)