Skip to content

setdb: lwdb-native local-DB switcher + release-aware installer - #23

Merged
sibinc merged 8 commits into
mainfrom
setdb-command
Jul 3, 2026
Merged

setdb: lwdb-native local-DB switcher + release-aware installer#23
sibinc merged 8 commits into
mainfrom
setdb-command

Conversation

@sibinc

@sibinc sibinc commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

What

Adds lwdb setdb — points the local Linways app at a chosen server+db by rendering a single PHP include (active-db.php) from a connection in the lwdb store. Replaces the old standalone setDB PHP script + in-repo dbconfs/*.txt credential files.

setdb command

  • Interactive for humans (TTY); --json for agents (strict exit codes).
  • --status, --print (dry run), --init (create file + print the include line to paste, flagged "must be LAST").
  • Connections/creds sourced from the lwdb store (registry.getConnection) — nothing secret in any app repo.
  • Correct PHP escaping via single-quoted literals ($/%/' safe) — fixes the old concat approach.

Config homed in ~/.lwdb/

  • ~/.lwdb/setdb.json (targets: output path, includeInto, group, verify) and ~/.lwdb/college-codes.json (code map).
  • Both auto-seeded by install/update (never clobbering an edited config); includeInto ships empty (machine-specific).
  • active-db.php defaults to ~/.lwdb/dev/active-db.php — app tree stays clean; conf files include it by absolute path.

Installer

  • Release-aware update: compares latest GitHub release to the installed desktop .deb, prompts, installs.

Tests

12/12 pass: setdbTarget, setdbConfig, install suites (render/escaping, config discovery + home fallback, seeding no-clobber, semver/deb-asset).

Docs: docs/setdb.md.

@sibinc
sibinc merged commit dd4729b into main Jul 3, 2026
6 checks passed
@sibinc
sibinc deleted the setdb-command branch July 3, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants