Export and import site settings

Hey team!

I am weary of being able to visit https://mysite.co.nz/admin/site_settings.json and which gives me a complete list of all my settings I have changed.

Now my problem is, I am using discourse as SaaS, and don’t use the whole package, which gives me issues when needing to bash into the box.

Basically i have these site settings, and would like to import them into my uat forum here: https://forum.uat.forumpage/

I want to do this because i want to change settings in the UAT environment while I build a version 2 of my theme, but i will find it impossible to monitor which settings are changed.

Ideally i would like to import my prod settings into UAT, make changes, tweak styles, and then when i port over my UAT theme into prod I will also be able to import my settings.

For example, a setting that will change is that we want to swap the categories from just categories with boxes, to categories with the latest. Styling the latter will result in different classes, so the problem would be when i then export and then import the UAT theme into production I will also need these settings to change or it will all fall over.

Edit: I am also weary there is a settings.yml file that comes bundled when i export my theme. This also is not correct because that file doesn’t contain my settings

Hope this all makes sense.

Kind regards,

Phillip

2 Likes

Your site settings are in discourse database in the site_settings table:

discourse=# select count(1) from site_settings;
 count 
-------
    78
(1 row)

This information is already includes in your DB backup and you could get it from there; or you could dump this table directly with this generic command line utility:

pg_dump -d <database_name> -t <table_name> > file.sql

for example:

su postgres -c 'pg_dump -d  discourse -t site_settings >  /shared/neo/my_site_settings.sql'

Actual example and results:

# su postgres -c 'pg_dump -d discourse -t site_settings > /shared/neo/my_site_settings.sql'
# cd /shared/neo
# ls -l
total 12
-rw-r--r-- 1 postgres postgres 10653 Apr 16 02:04 my_site_settings.sql
#

Sorry man, thanks for the reply but we dont self host

We do self host our UAT environment, so we can get the settings from that DB, but we are stuck trying to import them into our prod environment which they host for us as a SaaS

This might help

7 Likes

Thanks Jay

My senior legendary gave the nod that this is the ticket.

Thanks again :slight_smile: it should be smooth sailing now

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.