Neater formatting of config description text

This commit is contained in:
Simon Willison 2019-05-03 18:01:21 -04:00
commit 4935cc5c06

View file

@ -50,138 +50,80 @@ MEMORY = object()
ConfigOption = collections.namedtuple("ConfigOption", ("name", "default", "help"))
CONFIG_OPTIONS = (
ConfigOption(
"default_page_size",
100,
"""
Default page size for the table view
""".strip(),
),
ConfigOption("default_page_size", 100, "Default page size for the table view"),
ConfigOption(
"max_returned_rows",
1000,
"""
Maximum rows that can be returned from a table or custom query
""".strip(),
"Maximum rows that can be returned from a table or custom query",
),
ConfigOption(
"num_sql_threads",
3,
"""
Number of threads in the thread pool for executing SQLite queries
""".strip(),
"Number of threads in the thread pool for executing SQLite queries",
),
ConfigOption(
"sql_time_limit_ms",
1000,
"""
Time limit for a SQL query in milliseconds
""".strip(),
"sql_time_limit_ms", 1000, "Time limit for a SQL query in milliseconds"
),
ConfigOption(
"default_facet_size",
30,
"""
Number of values to return for requested facets
""".strip(),
"default_facet_size", 30, "Number of values to return for requested facets"
),
ConfigOption(
"facet_time_limit_ms",
200,
"""
Time limit for calculating a requested facet
""".strip(),
"facet_time_limit_ms", 200, "Time limit for calculating a requested facet"
),
ConfigOption(
"facet_suggest_time_limit_ms",
50,
"""
Time limit for calculating a suggested facet
""".strip(),
"Time limit for calculating a suggested facet",
),
ConfigOption(
"hash_urls",
False,
"""
Include DB file contents hash in URLs, for far-future caching
""".strip(),
"Include DB file contents hash in URLs, for far-future caching",
),
ConfigOption(
"allow_facet",
True,
"""
Allow users to specify columns to facet using ?_facet= parameter
""".strip(),
"Allow users to specify columns to facet using ?_facet= parameter",
),
ConfigOption(
"allow_download",
True,
"""
Allow users to download the original SQLite database files
""".strip(),
),
ConfigOption(
"suggest_facets",
True,
"""
Calculate and display suggested facets
""".strip(),
),
ConfigOption(
"allow_sql",
True,
"""
Allow arbitrary SQL queries via ?sql= parameter
""".strip(),
"Allow users to download the original SQLite database files",
),
ConfigOption("suggest_facets", True, "Calculate and display suggested facets"),
ConfigOption("allow_sql", True, "Allow arbitrary SQL queries via ?sql= parameter"),
ConfigOption(
"default_cache_ttl",
5,
"""
Default HTTP cache TTL (used in Cache-Control: max-age= header)
""".strip(),
"Default HTTP cache TTL (used in Cache-Control: max-age= header)",
),
ConfigOption(
"default_cache_ttl_hashed",
365 * 24 * 60 * 60,
"""
Default HTTP cache TTL for hashed URL pages
""".strip(),
"Default HTTP cache TTL for hashed URL pages",
),
ConfigOption(
"cache_size_kb",
0,
"""
SQLite cache size in KB (0 == use SQLite default)
""".strip(),
"cache_size_kb", 0, "SQLite cache size in KB (0 == use SQLite default)"
),
ConfigOption(
"allow_csv_stream",
True,
"""
Allow .csv?_stream=1 to download all rows (ignoring max_returned_rows)
""".strip(),
"Allow .csv?_stream=1 to download all rows (ignoring max_returned_rows)",
),
ConfigOption(
"max_csv_mb",
100,
"""
Maximum size allowed for CSV export in MB - set 0 to disable this limit
""".strip(),
"Maximum size allowed for CSV export in MB - set 0 to disable this limit",
),
ConfigOption(
"truncate_cells_html",
2048,
"""
Truncate cells longer than this in HTML table view - set 0 to disable
""".strip(),
"Truncate cells longer than this in HTML table view - set 0 to disable",
),
ConfigOption(
"force_https_urls",
False,
"""
Force URLs in API output to always use https:// protocol
""".strip(),
"Force URLs in API output to always use https:// protocol",
),
)
DEFAULT_CONFIG = {option.name: option.default for option in CONFIG_OPTIONS}