How can I import/export settings into a file?

Is it possible, after tuning Discourse on local computer, to export all settings into file and upload them into production?

Thanks.

I guess probably you can export your settings from DB.

discourse=>\dt
...
...
 public | single_sign_on_records     | table | discourse
 public | site_customizations        | table | discourse
 public | site_settings              | table | discourse
 public | stylesheet_cache           | table | discourse
...
...

Notice site_settings table. You can also take this data from your backup. It already have a dump of your database inside it.

Then all you need to do is restore this table to your server from your local dump. :thumbsup:

1 Like

Courtesy of @blake we now have rake tasks to export/import site settings:

rake site_settings:export > settings.yml
rake site_settings:import < settings.yml
4 Likes

For those who do not have access to rake tasks, I also have contributed a settings uploader that uses the API: GitHub - pfaffman/discourse-settings-uploader: Install a Discourse settings JSON file to a site

4 Likes

Hello,

I’ve used discourse-settings-uploader to upload site_settings.json file from the GitHub Jay mentioned. I get this error when I run it:

./discourse-settings-uploader:39:in `<main>': undefined method `each' for nil:NilClass (NoMethodError)

line39: settings['site_settings'].each do |setting|
line40:  jsetting (setting) unless setting['value'] == setting['default']
line41: end

I used an API key for “All Users” and used “system” when I ran discourse-settings-uploader.
Any thoughts?