Skip to content

Commit 3eab918

Browse files
committed
autogenerate global server settings
1 parent 178fd19 commit 3eab918

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"config": {
66
"clickhouse_repo_folders": "docs/en/development docs/en/engines docs/en/getting-started docs/en/interfaces docs/en/operations docs/en/sql-reference",
7-
"autogen_needed_files": "src/Core/FormatFactorySettings.h src/Core/Settings.cpp CHANGELOG.md"
7+
"autogen_needed_files": "src/Core/FormatFactorySettings.h src/Core/Settings.cpp CHANGELOG.md, docs/en/operations/server-configuration-parameters/_server_settings_outside_source.md"
88
},
99
"scripts": {
1010
"build": "yarn copy-clickhouse-repo-docs && yarn run-markdown-linter && yarn generate-changelog && yarn autogenerate-settings && yarn autogenerate-table-of-contents && yarn build-api-doc && yarn build-swagger && yarn build-docs",

scripts/settings/autogenerate-settings.sh

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,84 @@ SELECT prefix || (SELECT groupConcat(*) FROM main_content)
119119
INTO OUTFILE 'settings.md' TRUNCATE FORMAT LineAsString
120120
" > /dev/null || { echo "Failed to Autogenerate Core settings"; exit 1; }
121121

122+
./clickhouse -q "
123+
WITH
124+
settings_outside_source AS
125+
(
126+
SELECT
127+
arrayJoin(extractAllGroups(raw_blob, '## (\\w+)(?:\\s[^\n]+)?\n\\s+((?:[^#]|#[^#]|##[^ ])+)')) AS g,
128+
g[1] AS name,
129+
replaceRegexpAll(replaceRegexpAll(g[2], '\n(Type|Default( value)?): [^\n]+\n', ''), '^\n+|\n+$', '') AS doc
130+
FROM file('_server_settings_outside_source.md', RawBLOB)
131+
),
132+
settings_in_source AS
133+
(
134+
SELECT
135+
name,
136+
replaceRegexpAll(description, '(?m)^[ \t]+', '') AS description
137+
FROM system.server_settings
138+
),
139+
combined_settings AS
140+
(
141+
SELECT
142+
name,
143+
description
144+
FROM settings_in_source
145+
UNION ALL
146+
SELECT
147+
name,
148+
doc AS description
149+
FROM settings_outside_source
150+
),
151+
formatted_settings AS
152+
(
153+
SELECT
154+
format('## {} {}\n\n{}\n\n', name, '{#'||name||'}', description) AS formatted_text
155+
FROM combined_settings
156+
ORDER BY name ASC
157+
),
158+
prefix_text AS
159+
(
160+
SELECT
161+
'---
162+
description: ''This section contains descriptions of server settings that cannot be
163+
changed at the session or query level.''
164+
keywords: [''global server settings'']
165+
sidebar_label: ''Global Server Settings''
166+
sidebar_position: 57
167+
slug: /operations/server-configuration-parameters/settings
168+
title: Global Server Settings
169+
---
170+
171+
import Tabs from ''@theme/Tabs'';
172+
import TabItem from ''@theme/TabItem'';
173+
import SystemLogParameters from ''@site/docs/operations/server-configuration-parameters/_snippets/_system-log-parameters.md''
174+
175+
# Global Server Settings
176+
177+
This section contains descriptions of server settings that cannot be changed at
178+
the session or query level. These settings are stored in the `config.xml` file
179+
on the ClickHouse server. For more information on configuration files in
180+
ClickHouse see [""Configuration Files""](/operations/configuration-files).
181+
182+
Other settings are described in the ""[Settings](/operations/settings/overview)"" section.
183+
Before studying the settings, we recommend reading the [Configuration files](/operations/configuration-files)
184+
section and note the use of substitutions (the `incl` and `optional` attributes).
185+
186+
' AS prefix_content
187+
)
188+
SELECT
189+
arrayStringConcat([
190+
(SELECT prefix_content FROM prefix_text),
191+
arrayStringConcat(groupArray(formatted_text), '')
192+
], '')
193+
FROM formatted_settings
194+
INTO OUTFILE 'server_settings.md'
195+
TRUNCATE FORMAT LineAsString" > /dev/null || { echo "Failed to Autogenerate Format settings"; exit 1; }
196+
122197
mv settings-formats.md "$root/docs/operations/settings" || { echo "Failed to move generated settings-format.md"; exit 1; }
123198
mv settings.md "$root/docs/operations/settings" || { echo "Failed to move generated settings.md"; exit 1; }
199+
mv server_settings.md "$root/docs/operations/server-configuration-parameters/settings.md" || { echo "Failed to move generated server_settings.md"; exit 1; }
124200

125201
echo "[$SCRIPT_NAME] Auto-generation of settings markdown pages completed successfully"
126202

0 commit comments

Comments
 (0)