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
Browse filesBrowse the repository at this point in the historyBrowse files
authored
feat: read applyEnvVarsToBuild from actor.json in push (#734) (#1346)
Part of #734, stacked on #1345 (retarget to `master` once that merges —
only the last commit is new here).
## What
- `apify push` now reads `applyEnvVarsToBuild` from `.actor/actor.json`,
so the setting persists per repo and applies on every push (useful for
CI and Actors needing build-time secrets).
- Precedence: `--[no-]apply-env-vars-to-build` flag >
`applyEnvVarsToBuild` in actor.json > omitted (value stored on the
platform is kept). An explicit `false` in actor.json turns the setting
off.
- Documented in `docs/vars.md`; flag description updated (+ regenerated
`docs/reference.md`).
## Tests
- New `[api]` test covering field `true`, field `false`, flag-over-field
precedence, and the negated flag beating a `true` in the file (the case
that pins `??` over `||`). Full push API suite passes (14/14), plus
`test:local`, lint, format, build.
- Note for reviewers: `useActorConfig` caches by cwd, so the test resets
the cache when rewriting actor.json mid-test.
## Follow-up (separate PR)
- `--env KEY=VALUE` passing on push (the other half of #734).
No new dependencies; no install-size impact.
---------
Co-authored-by: Edyta <142720610+szaganek@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Richard Solár <solar.richard@gmail.com>
Copy file name to clipboardExpand all lines: docs/vars.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,3 +74,22 @@ You can use the CLI to manage secrets environment variables:
74
74
...
75
75
}
76
76
```
77
+
78
+
### Apply environment variables to the build
79
+
80
+
By default, custom environment variables are available only at runtime. To make them available also to the Actor build process, forexample, as Docker build arguments, set `applyEnvVarsToBuild`in`.actor/actor.json`:
81
+
82
+
```json
83
+
{
84
+
"actorSpecification": 1,
85
+
"name": "dataset-to-mysql",
86
+
"version": "0.1",
87
+
"buildTag": "latest",
88
+
"applyEnvVarsToBuild": true,
89
+
"environmentVariables": {
90
+
"MYSQL_PASSWORD": "@mySecretPassword"
91
+
}
92
+
}
93
+
```
94
+
95
+
To apply the environment variables to a single push, add the `--apply-env-vars-to-build` flag to the `apify push` command. To turn off the setting for a single push, add the `--no-apply-env-vars-to-build` flag. The flag overrides the value of the `applyEnvVarsToBuild` field. If you use neither the field nor a flag, the Apify platform keeps the stored setting.
'Make the environment variables also available to the Actor build process. Use --no-apply-env-vars-to-build to turn the setting off. When omitted, the setting currently stored on the platform is kept.',
227
+
description: `Make the environment variables also available to the Actor build process. Use --no-apply-env-vars-to-build to turn the setting off. Overrides the value of the 'applyEnvVarsToBuild' field in the '${LOCAL_CONFIG_PATH}' file. When both the field and the flag are omitted, the setting currently stored on the platform is kept.`,
229
228
required: false,
230
229
}),
231
230
};
@@ -459,8 +458,10 @@ Skipping push. Use --force to override.`,
459
458
allowMissing: this.flags.allowMissingSecrets,
460
459
})
461
460
: undefined;
462
-
// true/false when --[no-]apply-env-vars-to-build is passed, undefined when omitted so the value stored on the platform is preserved
463
-
const{ applyEnvVarsToBuild }=this.flags;
461
+
// The flag wins when passed, then the actor.json field; undefined when neither is set, so the value
0 commit comments