30 lines
785 B
Python
30 lines
785 B
Python
|
|
import sys
|
||
|
|
|
||
|
|
path = "/opt/amos/services/ecosystem.config.cjs"
|
||
|
|
content = open(path).read()
|
||
|
|
|
||
|
|
if "aamos-sie-import" in content:
|
||
|
|
print("ALREADY_EXISTS")
|
||
|
|
sys.exit(0)
|
||
|
|
|
||
|
|
new_entry = """
|
||
|
|
// ── AAMOS Finance — SIE4 Import ──────────────────────────────────────────
|
||
|
|
{
|
||
|
|
name: 'aamos-sie-import',
|
||
|
|
script: '/opt/amos/services/aamos-sie-import/index.mjs',
|
||
|
|
env: {
|
||
|
|
PORT: 3251,
|
||
|
|
DATABASE_URL: DB,
|
||
|
|
NODE_ENV: 'production',
|
||
|
|
SERVICE_NAME: 'aamos-sie-import',
|
||
|
|
}
|
||
|
|
},"""
|
||
|
|
|
||
|
|
updated = content.replace(" ]\n};", new_entry + "\n ]\n};")
|
||
|
|
if updated == content:
|
||
|
|
print("PATTERN_NOT_FOUND")
|
||
|
|
sys.exit(1)
|
||
|
|
|
||
|
|
open(path, "w").write(updated)
|
||
|
|
print("OK")
|