"""Run with the app stopped: python3 seed.py <isolated-T3-home>. Synthetic data only."""
import json, pathlib, sys
p=pathlib.Path(sys.argv[1])/'userdata'/'settings.json'
s=json.loads(p.read_text())
s.pop('sourceControlHosts',None)
s.pop('defaultAutoPull',None)
s.update(projectSettingsFolded=True,bitbucket={'email':'me@example.com','accessToken':'••••••'},github={'tokens':{'github.com':'••••••'}})
p.write_text(json.dumps(s,indent=2)+'\n')
d=p.parent/'secrets';d.mkdir(exist_ok=True)
for name,value in [('bitbucket-access-token','synthetic-bitbucket-token'),('github-token-Z2l0aHViLmNvbQ','synthetic-github-token')]:
 f=d/(name+'.bin')
 if f.exists(): f.chmod(0o600)
 f.write_text(value);f.chmod(0)
