Repository navigation
Centralise laptop tooling around one env definition (#116) - #121
Merged
Merged
Conversation
scripts/envs.ts is now the only place that names dev and prod: Azure subscription, resource group, Container App, Key Vault, file share, env file, and the prod/subscription guards. ha-devices, secrets-sync, register, command-access, restart, deploy and tf-apply all read it. - scripts/target.ts loads a Discord tool's env file in TypeScript, replacing the discord-env bash helper (still drops .env leaks). - scripts/env.ts answers recipes: show, shell, check-az, apply, deploy. - just env dev|prod; just deploy <env> (deploy-dev kept as an alias, deploy prod refuses); just --list grouped with clear summaries. - Tests pin the names to the Terraform example tfvars and fail if the justfile spells an Azure name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…centralize-cli-tools-8a8356 # Conflicts: # CHANGELOG.md # scripts/secrets-sync.ts
…centralize-cli-tools-8a8356 # Conflicts: # docs/architecture.md # docs/runbook.md
…-tools-8a8356 # Conflicts: # docs/architecture.md # docs/runbook.md # justfile
…-tools-8a8356 # Conflicts: # docs/architecture.md # docs/infra.md
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.
Closes #116.
Why
Most of #116 already landed in #113, #115 and #118:
just pull/just push,secrets-pull/secrets-pushand the secrets manifest. What remained was that every tool still kept its own copy of where each environment lives and how to guard it:REMOTESinha-devices-lib.ts,VAULTSinsecrets-sync-lib.ts, a hard-coded subscription inrestartanddeploy-dev, thediscord-envbash helper, and a prod check that differed from recipe to recipe.What
scripts/envs.tsis the one definition ofdevandprod: subscription, resource group, Container App, Key Vault, storage account and share, env file, plus the shared guards (PIXEL_ENVmatch, subscription,PIXEL_APPLY_PROD=1for prod applies, no laptop prod deploys). It's pure and tested.scripts/target.tsloads a Discord tool's env file in TypeScript, replacing thediscord-envbash. As before, it drops every key any env file sets before applying the chosen one, so.env(whichjustloads into every recipe) can't leak into another bot.register-ciopts out withPIXEL_ENV_SOURCE=process, and only does so in GitHub Actions.scripts/env.tsis what recipes call:show,shell(assignments toeval),check-az,apply,deploy.scripts/share.tsholds the file-share remote and theaz storage filearguments. They moved out ofha-devices-lib.ts.ha-devices,secrets-sync,register,command-access,restart,deployandtf-apply/tf-planall use these.register-env.tsis gone; its tests moved toenvs.test.ts.just env dev|prod.just deploy <env>replacesdeploy-dev, which stays as an alias for a release.just deploy prodrefuses, because prod ships from the Release workflow.just --listis grouped (develop, environments, config, terraform, release, docs) with readable summaries.ENVSmatchinfra/envs/*/terraform.example.tfvars.just deploy dev. ADRs, workflow comments and Terraform variable descriptions are left as they were, sincedeploy-devstill works.scripts/envs.ts.Changed.Not done (on purpose)
members.yamletc.). ADR 0016's addendum keeps those read-only mirrors that Pixel andjust ha-deviceswrite..github/workflows/, so the pipeline diagrams are unchanged.register-cionly gains an env var inside the recipe.Review notes
scripts/secrets-sync.ts/secrets-sync-lib.ts. My changes there are imports plusVAULTS/ storage-account lookups, so expect small conflicts at most.just check(1980 tests, coverage thresholds) andjust tf-validatepass.just tf-apply prod,just deploy prod, a missing.env.prodand a.env.devwithPIXEL_ENV=prod.PIXEL_ENV=prodin.envdoesn't leak intodev.just deploy dev,just restart,just ha-devices,just pull/just push. They touch Azure. Worth onejust deploy devand onejust pull devbefore merging.🤖 Generated with Claude Code