feat: --reset-conf flag (build.sh) + --gen-conf --force (init.sh) (closes #124)#129
Merged
Conversation
Closes #124. Adds a one-step path to restore the template's default setup.conf without the current `rm setup.conf && init.sh --gen-conf` dance, and wires backups so the reset is recoverable. init.sh — new backend `_gen_setup_conf` gains a force argument. Default behavior unchanged: refuse to overwrite an existing setup.conf. With --force, back up the current setup.conf → setup.conf.bak and (if present) .env → .env.bak, then overwrite from template/setup.conf. First-time provisioning (no pre-existing setup.conf) takes the fast path and does not create spurious .bak files. build.sh — new frontend --reset-conf flag prompts for confirmation (y/N), skippable with -y/--yes. Delegates to `./template/init.sh --gen-conf --force` and sets RUN_SETUP=true so the subsequent setup.sh pass regenerates .env + compose.yaml from the fresh conf. In --dry-run mode the init.sh call is printed instead of executed and the prompt is skipped (CI-safe). .gitignore — new-repo template `.env.bak` and `setup.conf.bak` added so the reset backups stay local and never get committed. Usage help (4 languages) documents --reset-conf, -y, and the backup behavior. Tests (+8): init_spec.bats exercises all four _gen_setup_conf paths (refuse / force overwrite with backup / also backs up .env / clean repo doesn't produce spurious .bak) plus a .gitignore entry check; build_sh_spec.bats covers the frontend (dry-run prints init.sh call / usage mentions --reset-conf / no prompt when nothing to overwrite). 677 → 685.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #124. One-step path to restore the template's default
setup.confwithout therm setup.conf && init.sh --gen-confdance.Changes
init.shbackend_gen_setup_confgains a force argument. Default behavior unchanged — refuses to overwrite. With--force, backs up the currentsetup.conf→setup.conf.bakand.env→.env.bakbefore overwriting. First-time provisioning (no pre-existing conf) skips the backup step.build.shfrontendDelegates to
./template/init.sh --gen-conf --forceand flipsRUN_SETUP=truesosetup.shregenerates.env+compose.yamlfrom the fresh conf in the same invocation..gitignore(new-repo template)Adds
.env.bakandsetup.conf.bakso reset backups stay local.Usage help
English + zh-TW + zh-CN + ja — all document
--reset-conf,-y, and the backup behavior.Scope not in this PR
run.sh/setup.shfrontends for--reset-conf— lower priority since thebuild.shentry point covers the common workflow. Can follow up later if demand surfaces.Tests (+8 → 685 total)
init_spec.bats:
_gen_setup_conf default refuses to overwrite existing setup.conf_gen_setup_conf --force overwrites and backs up existing setup.conf_gen_setup_conf --force also backs up .env to .env.bak_gen_setup_conf --force on clean repo does not create spurious .bak_create_new_repo: .gitignore includes setup.conf.bak and .env.bakbuild_sh_spec.bats:
build.sh --reset-conf --yes --dry-run prints init.sh --gen-conf --force cmdbuild.sh --reset-conf is mentioned in usage helpbuild.sh --reset-conf with no existing setup.conf / .env skips promptTest plan
make -f Makefile.ci testlocal — 685/685 passcd app/ros1_bridge && ./build.sh --reset-conf --yesresets conf + runs setup.sh, producing fresh.env+compose.yaml; old conf lands atsetup.conf.bak.