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