I have a custom script that needs to know the endpoint address of a remote API.
I neither want to hard code it into the script itself, nor have to read it from a file.
Is site_config.json
the correct place to put such things?
How does my Python code get at it, once I put it there?
1 Like
Hah! Got it!
I simply did …
cd ${HOME}/frappe-bench;
grep -r encryption_key
… and found what I wanted in apps/frappe/frappe/utils/password.py
frappe.local.conf.encryption_key
It doesn’t answer whether there is a preferred place to put such things though.
3 Likes
Thanks for sharing - these two may help piece together the picture too
frappe@ubuntu1804lts:~/frappe-bench$ bench console
In [1]: frappe.local.conf
Out[1]:
{'auto_update': False,
'background_workers': 1,
'dns_multitenant': True,
'file_watcher_port': 6787,
'frappe_user': 'frappe',
'gunicorn_workers': 2,
'maintenance_mode': 1,
'pause_scheduler': 1,
'rebase_on_pull': False,
'redis_cache': 'redis://localhost:13000',
'redis_queue': 'redis://localhost:11000',
'redis_socketio': 'redis://localhost:12000',
'restart_supervisor_on_update': True,
'restart_systemd_on_update': False,
'serve_default_site': True,
'shallow_clone': True,
'socketio_port': 9000,
'update_bench_on_update': True,
'webserver_port': 8000,
'db_name': '_1bd3e0294da19198',
'db_password': '8FKA3Sb0V2bFNjKy',
'db_type': 'mariadb',
'host_name': 'http://site1.local'}
frappe@ubuntu1804lts:~/frappe-bench$ bench show-config
Config Value
auto_update 0
background_workers 1
dns_multitenant 1
file_watcher_port 6787
frappe_user frappe
gunicorn_workers 2
maintenance_mode 1
pause_scheduler 1
rebase_on_pull 0
redis_cache redis://localhost:13000
redis_queue redis://localhost:11000
redis_socketio redis://localhost:12000
restart_supervisor_on_update 1
restart_systemd_on_update 0
serve_default_site 1
shallow_clone 1
socketio_port 9000
update_bench_on_update 1
webserver_port 8000
db_name _1bd3e0294da19198
db_password 8FKA3Sb0V2bFNjKy
db_type mariadb
host_name http://site1.local
2 Likes
Oh cool!
Yeah, that is useful!
(btw. These posts where I ask a question and immediately answer it are … notes to my self? I figure if I can’t immediately Google the answer I need, I’m likely not the first, or the last. So, it might save someone else some time)
1 Like
MartinHBramwell:
notes to my self
Yes exactly, keep them here as a reminder refresher to yourself