forked from CubeCraftLabs/CTXD
fix: entrypoint.sh set -e crash, __main__.py PostgreSQL check, cli.py seed placeholders
- entrypoint.sh: use NEEDS_INIT variable instead of exit codes (set -e was killing the script) - __main__.py: skip db_path.exists() check when using PostgreSQL - cli.py: use dual-backend placeholders for _seed_context (was using SQLite ? syntax) - cli.py: use 'admin' instead of 'system' for seed updated_by (FK constraint)
This commit is contained in:
@@ -4,7 +4,10 @@ import sys
|
||||
|
||||
if len(sys.argv) > 1 and sys.argv[1] in ('init', 'serve', 'project-list', 'project-create',
|
||||
'read', 'cat', 'edit', 'search', 'sync', 'audit',
|
||||
'user-list', 'user-create', 'import-vault'):
|
||||
'user-list', 'user-create', 'import-vault',
|
||||
'user-set-password', 'oauth-client-create',
|
||||
'oauth-client-list', 'oauth-client-revoke',
|
||||
'file-list', 'file-read'):
|
||||
from ctxd.cli import cli_entry
|
||||
cli_entry()
|
||||
else:
|
||||
@@ -12,7 +15,9 @@ else:
|
||||
from ctxd.server import serve_sync
|
||||
|
||||
cfg = CtxConfig.from_home()
|
||||
if not cfg.db_path.exists():
|
||||
# When using PostgreSQL, the DB is external — skip the file check.
|
||||
# When using SQLite, verify the db file exists.
|
||||
if not cfg.use_postgres and not cfg.db_path.exists():
|
||||
print("Not initialized. Run 'ctx init' first.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
serve_sync(cfg)
|
||||
Reference in New Issue
Block a user