You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a9e48de
Browse filesBrowse the repository at this point in the historyBrowse files
Give a service its own env, and make services optional
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.
|`services`| Your application services, keyed by name. **Required.**See [Services](./services.md). |
30
+
|`services`| Your application services, keyed by name. See [Services](./services.md). Without it, the config sets the environment of `exec` and `run` alone.|
31
31
|`serviceRootDir`| The directory services live under, e.g. `'apps'`: each service is at `<serviceRootDir>/<name>`. **Recommended.** Without it, every service sets `targetDir`. |
32
32
|`env`| Variables of the config's own, and how `.env` files load. See [Environment](./env.md). |
33
33
|`logs`| On-screen timestamps. See [Logs](./logs.md). |
Copy file name to clipboardExpand all lines: docs/config/services.md
+38-1Lines changed: 38 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
description: Every option of a service in stackctl.config.ts - port, healthcheck and readiness, deps, command, urls, autostart, tokens, logs, color and directory.
2
+
description: Every option of a service in stackctl.config.ts - port, healthcheck and readiness, deps, command, urls, autostart, its own env files and variables, tokens, logs, color and directory.
3
3
---
4
4
5
5
# Services
@@ -41,6 +41,7 @@ Every option is optional. `{}` is a valid service: it runs the `dev` script in
41
41
|[`autostart`](#autostart)|`true`| Whether it starts with the session. |
42
42
|[`selectable`](#selectable)|`true`| Whether the picker lists it. |
43
43
|[`targetDir`](#targetdir)|`<serviceRootDir>/<name>`| The service's directory. |
44
+
|[`env`](#env)| the config's |`.env` files, variables and overrides of its own. |
44
45
|[`tokens`](#tokens)| none | Values for this service's callbacks. |
45
46
|[`logs`](#logs)| inherits | Timestamps and log formatting for this service. |
46
47
|[`color`](#color)| assigned | The color of its log label. |
@@ -175,6 +176,42 @@ lives somewhere else. It is required when the config has no `serviceRootDir`.
175
176
-**It decides which `.env` files load**: those of every directory from the root down to it.
176
177
See [Which files load](../guide/env.md#which-files-load).
|`services`| Each service's `port`, `publicOrigin`, `urls`, `healthcheck`, `deps`, `command`, `targetDir` (as written) and `resolvedTargetDir` (absolute). |
273
+
|`services`| Each service's `port`, `publicOrigin`, `urls`, `healthcheck`, `deps`, `command`, `targetDir` (as written), `resolvedTargetDir` (absolute), and its [`env`](../config/services.md#env) combined with the config's: `envFiles`, `envOverride` and `envVars`. |
274
274
|`infra`| Per provider: the compose `file`, the profile's `projectName`, and each service's `enabled`, `port`, `urls` and `publicOrigin`. |
275
275
|`reverseProxy`| Its `port`, `tls`, `publicAddress` and `routes`. |
276
-
|`envFiles`| The `.env` filenames the profile looks for in each directory, in load order. |
276
+
|`envFiles`| The `.env` filenames the profile looks for in each directory, in load order. A service's own are on the service.|
277
277
278
278
Functions (`logs.formatter`, infra callbacks) have no JSON form and are left out.
0 commit comments