Fix save config running before bootstrap for new databases.
This commit is contained in:
@@ -59,18 +59,14 @@ def _format_value(value: Any, use_color: bool, max_len: int = 60) -> str:
|
||||
if isinstance(value, dict):
|
||||
if not value:
|
||||
return "{}"
|
||||
# For small dicts, show inline
|
||||
if len(value) == 1:
|
||||
k, v = next(iter(value.items()))
|
||||
return "{" + f"{k}: {_format_value(v, use_color, max_len=30)}" + "}"
|
||||
return f"{{...{len(value)} keys}}"
|
||||
parts = [f"{k}: {_format_value(v, use_color, max_len=30)}" for k, v in value.items()]
|
||||
return "{" + ", ".join(parts) + "}"
|
||||
|
||||
if isinstance(value, list):
|
||||
if not value:
|
||||
return "[]"
|
||||
if len(value) == 1:
|
||||
return "[" + _format_value(value[0], use_color, max_len=30) + "]"
|
||||
return f"[...{len(value)} items]"
|
||||
parts = [_format_value(v, use_color, max_len=30) for v in value]
|
||||
return "[" + ", ".join(parts) + "]"
|
||||
|
||||
# Fallback for other types
|
||||
text = str(value)
|
||||
|
||||
@@ -199,15 +199,16 @@ def main():
|
||||
|
||||
startupbox.print_startup_config(config)
|
||||
|
||||
# Build config to save (will be saved after bootstrap in async_main)
|
||||
save_config = None
|
||||
if args.save:
|
||||
new_config = Config(
|
||||
save_config = Config(
|
||||
rp_id=args.rp_id,
|
||||
rp_name=args.rp_name,
|
||||
origins=args.origins,
|
||||
auth_host=args.auth_host,
|
||||
listen=args.listen,
|
||||
)
|
||||
asyncio.run(set_config(new_config))
|
||||
|
||||
run_kwargs: dict = {
|
||||
"log_level": "warning", # Suppress startup messages; we use custom logging
|
||||
@@ -230,6 +231,8 @@ def main():
|
||||
bootstrap=False,
|
||||
)
|
||||
await bootstrap_if_needed()
|
||||
if save_config is not None:
|
||||
await set_config(save_config)
|
||||
await flush()
|
||||
|
||||
if len(endpoints) > 1:
|
||||
|
||||
Reference in New Issue
Block a user