Files
Investidor-V2/outputs/investmoz-legado-ativacao-20261015/enable-reader.py
T
nala 6a76aac80f
tests / ci (push) Canceled after 0s
versao compilada 1
2026-10-16 09:17:28 +02:00

7 lines
1.1 KiB
Python

from pathlib import Path
import json,hashlib,datetime,re
r=Path.cwd();o=r/'outputs/investmoz-legado-ativacao-20261015';b=json.loads((o/'FRESH-BACKUP.json').read_text());private=Path(b['private_directory']);p=r/'.env';raw=p.read_bytes();assert raw==(private/'files/.env').read_bytes();v=json.loads((o/'PUBLISHED-BEFORE-ENABLE.json').read_text());assert len(v['resources'])==2 and all(x['published'] and x['malware_scan_status']=='clean' for x in v['resources']);assert not re.search(rb'(?m)^PORTAL_LEGACY_CONTENT_ENABLED=',raw)
extra=(b'' if raw.endswith(b'\n')else b'\r\n')+b'PORTAL_LEGACY_CONTENT_ENABLED=true\r\n';updated=raw+extra
with p.open('r+b')as f:f.write(updated);f.truncate()
v={'at':datetime.datetime.now(datetime.timezone.utc).isoformat(),'setting':'PORTAL_LEGACY_CONTENT_ENABLED','before':False,'after':True,'only_one_setting_added':True,'remaining_env_preserved_byte_for_byte':updated[:-len(extra)]==raw,'B_flag_unchanged':True,'env_before_sha256':hashlib.sha256(raw).hexdigest(),'env_after_sha256':hashlib.sha256(updated).hexdigest()};(o/'READER-ENABLED.json').write_text(json.dumps(v,indent=2)+'\n');print(json.dumps(v))