Commit 425b0b87 authored by Daniel Dehennin's avatar Daniel Dehennin

feat(settings): import discourse settings from Salt configuration

Define a `discourse:settings` dict with settings from
https://github.com/discourse/discourse/blob/master/config/site_settings.yml
parent 0a00b120
......@@ -17,6 +17,15 @@ values:
# letsencrypt:
# enabled: true
# account_email: 'me@example.net'
# configure settings
# https://github.com/discourse/discourse/blob/master/config/site_settings.yml
settings:
default_locale: en
title: Discourse
site_description: ~
short_site_description: ~
contact_email: ~
contact_url: ~
# users: {}
launcher:
rebuild_cmd: './launcher rebuild app'
......
......@@ -3,3 +3,4 @@
include:
- .users
- .settings
---
# Automatically generated by SaltStack
# Do not edit
{{ salt['slsutil.serialize']('yaml', settings, default_flow_style=False) }}
...
# -*- coding: utf-8 -*-
# vim: ft=sls
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_service_running = tplroot ~ '.service.running' %}
{%- from tplroot | path_join("map.jinja") import discourse with context %}
{%- from tplroot | path_join("libtofs.jinja") import files_switch with context %}
include:
- {{ sls_service_running }}
{%- set settings_filename = 'global.yaml' %}
{%- set settings_contairer_path = '/shared' | path_join('settings',
settings_filename)
%}
{%- set settings_path = discourse.directory | path_join('shared',
'standalone',
'settings',
settings_filename)
%}
{%- set import_cmd = 'cd /var/www/discourse/ '
~ '&& rake site_settings:import '
~ '< ' ~ settings_contairer_path
%}
{%- set settings = discourse | traverse('settings', {}) %}
discourse-setup-settings-global-file-managed:
file.managed:
- name: {{ settings_path }}
- source: {{ files_switch(['settings.yaml.jinja'],
lookup='discourse-setup-settings-global-file-managed',
use_subpath=True
)
}}
- mode: 644
- user: root
- group: root
- makedirs: True
- template: jinja
- context:
settings: {{ settings | tojson }}
- require:
- sls: {{ sls_service_running }}
discourse-setup-settings-global-import-cmd-run:
cmd.run:
- name: {{ discourse | traverse('launcher:run_cmd')
~ " '"
~ import_cmd
~ "'"
}}
- cwd: {{ discourse.directory }}
- require:
- sls: {{ sls_service_running }}
# -*- coding: utf-8 -*-
# vim: ft=sls
include:
- .global
......@@ -14,6 +14,14 @@ discourse:
letsencrypt:
enabled: true
account_email: 'me@example.net'
settings:
default_locale: fr
title: This is a sample Discourse
site_description: This is a web forum based on Discourse
short_site_description: Web forum
contact_email: william.shakespears@example.net
contact_url: https://shakespears.example.net
default_trust_level: '1'
users:
william:
# Password reset mail is sent by default
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment