65 lines
2.2 KiB
Python
65 lines
2.2 KiB
Python
with open('appwrite-coolify.yml', 'r') as f:
|
|
lines = f.readlines()
|
|
|
|
out = []
|
|
in_executor_env = False
|
|
for line in lines:
|
|
if 'container_name: exc1' in line:
|
|
pass
|
|
if line.strip() == 'appwrite-mariadb:':
|
|
in_executor_env = False
|
|
|
|
if line.strip() == 'image: docker.io/library/mariadb:10.11':
|
|
out.append(line.replace('docker.io/library/mariadb:10.11', 'mariadb:10.11'))
|
|
continue
|
|
|
|
if line.strip() == '- MYSQL_DATABASE=${_APP_DB_SCHEMA:-appwrite}':
|
|
out.append(line.replace('${_APP_DB_SCHEMA:-appwrite}', '${_APP_DB_SCHEMA}'))
|
|
continue
|
|
|
|
if line.strip() == '- MYSQL_ROOT_PASSWORD=$SERVICE_PASSWORD_MARIADBROOT':
|
|
out.append(line.replace('$SERVICE_PASSWORD_MARIADBROOT', '${_APP_DB_ROOT_PASS}'))
|
|
continue
|
|
|
|
if line.strip() == '- MYSQL_USER=$SERVICE_USER_MARIADB':
|
|
out.append(line.replace('$SERVICE_USER_MARIADB', '${_APP_DB_USER}'))
|
|
continue
|
|
|
|
if line.strip() == '- MYSQL_PASSWORD=$SERVICE_PASSWORD_MARIADB':
|
|
out.append(line.replace('$SERVICE_PASSWORD_MARIADB', '${_APP_DB_PASS}'))
|
|
continue
|
|
|
|
if line.startswith('networks:'):
|
|
out.append(line)
|
|
continue
|
|
|
|
if line.strip() == 'name: gateway' or line.strip() == 'name: appwrite' or line.strip() == 'name: runtimes':
|
|
out.append(line)
|
|
out.append(' external: true\n')
|
|
continue
|
|
|
|
# Fix Executor
|
|
if line.strip() == 'environment:' and out[-1].strip() == '- /tmp:/tmp:rw':
|
|
out.append(line)
|
|
in_executor_env = True
|
|
continue
|
|
|
|
if in_executor_env and line.strip().startswith('- '):
|
|
# Convert to dictionary format
|
|
stripped = line.strip()[2:] # remove "- "
|
|
if '=' in stripped:
|
|
k, v = stripped.split('=', 1)
|
|
# Remove existing quotes if any
|
|
if v.startswith('"') and v.endswith('"'):
|
|
v = v[1:-1]
|
|
if k == 'OPEN_RUNTIMES_NFT' and v == '$_APP_OPEN_RUNTIMES_NFT':
|
|
v = '${_APP_OPEN_RUNTIMES_NFT}'
|
|
out.append(f" {k}: {v}\n")
|
|
continue
|
|
|
|
out.append(line)
|
|
|
|
with open('appwrite-coolify.yml', 'w') as f:
|
|
f.writelines(out)
|
|
|