Find site main url in its database

Hello,

I am currently tring to link as properly as possible a data crawler (Adminer, an OpenSource software) with the database created by Frappe.

For ease of use I would like to show the related website in bracket on the right of the database name.
image

It won’t be a problem to do so if I can find the url somewhere in the database, but in Frappe the url seems to be only found by using frappe.local.conf, which use the data in site_config.json.

Do anyone know where in the database I could find it ?

You can add a custom field somewhere and store it there? You’ve to populate the field manually.

Or alternatively use default company name to know which company’s database you’re looking into, as site url can change and you’ve to update custom field manually.

Thank you, I will look for either of those. Default company seems easier.
Didn’t think about looking for it instead of the url.

@revant_one This is the ultimate solution with customization, but does Frappe itself store settings or configurations in the database?

I like excluding the domain name from the database.

This makes sites much more portable.

You can easily copy/clone/restore to unique site names for ease of moving between dev, prod, and staging environments.

With this approach I can restore a site to a unique site name, domain name, and/or database name by modifying the site_config.json

1 Like

To change a site name I personally use:

cd frappe-bench/sites
sudo systemctl stop nginx
mv oldsitename newsitename
bench setup nginx
sudo systemctl restart nginx

I prefer not interfering directly with site-config.json as there are many ways to create issues by doing so.
One additional quote at the end of the last line for example.
Or two sites targeting the same db (it would work, but only one of the two sites can be active at a time).

And I absolutely agree with the ease of use the fact that neither the url nor the db name are stored in the database brings