Repository navigation
Give a service its own env, and make services optional - #25
Merged
Merged
Conversation
A service takes an env of its own, with the top level's vars, override and additionalFiles (or the vars callback) and an inherits flag, true by default. Inheriting, its vars merge over the config's, its override adds to the config's, and its additional files load after the config's, a file named at both levels being an error. With inherits: false the config's three options don't apply to it. decrypt stays workspace-wide. defineConfig resolves each service's combined options once, onto envFiles, envOverride and envVars on the resolved service, which its callbacks, its process, exec, run and resolveEnv() use. Two things had to change for that to hold. A target's process now starts from process.env with the workspace layer the CLI merged into it undone, then takes its own layer, since that layer already holds the config's files and vars when they are its; without this a service that doesn't inherit got them through process.env anyway. And the .env watcher keeps one target per directory and file list, so a file only one service looks for restarts that service alone, with what one directory's targets report within 50 ms counted as one change. services is optional: a config may only set the environment of exec and run. stackctl start says the config declares no services and exits 1. The docs gain a service env section, and CHANGELOG.md records 0.10.0.
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.
A service takes an
envof its own, andservicesis optional. Releases 0.10.0.services.<name>.env:vars,override,additionalFiles(or thevarscallback) andinherits(defaulttrue). Inheriting, itsvarsmerge over the config's,overrideadds,additionalFilesload after the config's; withinherits: falseonly its own apply. Nodecrypt: that stays workspace-wide.envFiles,envOverrideandenvVars, used by its callbacks, its process,exec/run/resolveEnv()and the.envwatcher.process.envminus the workspace layer the CLI merged in, then takes its own layer, so a service that doesn't inherit gets none of the config's env.servicesoptional:stackctl startwith none says so and exits 1;exec,run,show-configwork.envsection inconfig/services.md, pointers from the env and commands pages,show-configfields.Verification
pnpm buildpnpm lintpnpm test(2607 passed, type tests included)pnpm test:e2e(23 passed)pnpm docs:build(no dead links)node maintenance/scripts/changelog.ts check(releases 0.10.0)show-configonexample/and four projects that link stackctlaffected.tslisted demo, picker, run-screen and getting-started; all skipped, as the example declares no serviceenvand its services resolve the same values.