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
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,24 @@ pnpm run dev:apify create my-actor
33
33
34
34
`pnpm run dev:actor` does the same for the in-Actor `actor` binary.
35
35
36
+
## Environment variables
37
+
38
+
Use the following environment variables to configure the CLI.
39
+
40
+
### `APIFY_CONSOLE_URL`
41
+
42
+
Changes the base URL of Apify Console that the CLI prints and opens. For example, the run, build, dataset and key-value store URLs, or the browser page for the `apify login` flow.
43
+
44
+
The default value is `https://console.apify.com`.
45
+
46
+
To point the CLI at a local Console instance during development, use:
47
+
48
+
```bash
49
+
export APIFY_CONSOLE_URL=http://localhost:3000
50
+
```
51
+
52
+
Note that if `APIFY_CONSOLE_URL` points at `localhost`, `apify login` validates your token against `http://localhost:3333`. All other commands still call the production API at `https://api.apify.com`.
53
+
36
54
## Code style
37
55
38
56
The repo uses three tools, wired together via a pre-commit hook (`husky` + `lint-staged`):
description: Learn how use environment variables for Apify CLI
2
+
description: Learn how to define environment variables for your Actors using the Apify CLI.
3
3
title: Environment variables
4
4
---
5
5
6
-
There are two options how you can set up environment variables for Actors.
6
+
You can use the CLI to set environment variables for your Actors.
7
7
8
-
### Set up environment variables in `.actor/actor.json`
8
+
For the list of the system variables that Apify provides, see [Environment variables](https://docs.apify.com/actors/development/programming-interface/environment-variables).
9
9
10
-
All keys from `environmentVariables` will be set as environment variables into Apify platform after you push Actor to Apify. Current values on Apify will be overridden.
10
+
## Custom environment variables
11
+
12
+
To pass additional configuration to your Actor, define custom environment variables.
13
+
14
+
### Define in `.actor/actor.json`
15
+
16
+
To set custom variables, add them to the `environmentVariables` object in `.actor/actor.json` and push the Actor to Apify:
11
17
12
18
```json
13
19
{
@@ -22,10 +28,19 @@ All keys from `environmentVariables` will be set as environment variables into A
22
28
}
23
29
```
24
30
25
-
### Set up environment variables in Apify Console
31
+
Variables defined in `.actor/actor.json` override the ones defined in Apify Console.
32
+
33
+
### Define in Apify Console
34
+
35
+
To set custom variables in Apify Console:
26
36
27
-
In [Apify Console](https://console.apify.com/actors) select your Actor, you can set up variables into Source tab.
28
-
After setting up variables in the app, remove the `environmentVariables` from `.actor/actor.json`. Otherwise, variables from `.actor/actor.json` will override variables in the app.
37
+
1. Log in to [Apify Console](https://console.apify.com).
38
+
1. In the left-side panel, go to **Development** > **My Actors**.
39
+
1. From the table, select the Actor you want to configure.
40
+
1. Go to the **Source** tab > **Code**.
41
+
1. Expand the **Environment variables** section.
42
+
43
+
Once done, delete `environmentVariables` from `.actor/actor.json`. Variables defined in that file override the ones defined in Apify Console.
29
44
30
45
```json
31
46
{
@@ -36,41 +51,26 @@ After setting up variables in the app, remove the `environmentVariables` from `.
36
51
}
37
52
```
38
53
39
-
#### How to set secret environment variables in `.actor/actor.json`
54
+
###Define secrets
40
55
41
-
CLI provides commands to manage secrets environment variables. Secrets are stored to the `~/.apify` directory.
42
-
You can add a new secret using the command:
56
+
You can use the CLI to manage secrets environment variables:
43
57
44
-
```bash
45
-
apify secrets add mySecretPassword pwd1234
46
-
```
58
+
1. To add a secret, use the `apify secrets add` command. All secrets are stored in the `~/.apify` directory.
47
59
48
-
After adding a new secret you can use the secret in `.actor/actor.json`.
60
+
```bash
61
+
apify secrets add mySecretPassword pwd1234
62
+
```
49
63
50
-
```text
51
-
{
52
-
"actorSpecification": 1,
53
-
"name": "dataset-to-mysql",
54
-
...
55
-
"environmentVariables": {
56
-
"MYSQL_PASSWORD": "@mySecretPassword"
57
-
},
58
-
...
59
-
}
60
-
```
61
-
62
-
## Environment variables that configure the CLI
63
-
64
-
Use the following environment variable to point the CLI at a non-production Apify Console, such as a staging deployment or a local instance during development.
65
-
66
-
### `APIFY_CONSOLE_URL`
67
-
68
-
Overrides the base URL of [Apify Console](https://console.apify.com) used when the CLI prints links. For example, run, build, dataset and key-value store URLs, or the `apify login` browser flow. When unset, the production Console at `https://console.apify.com` is used.
69
-
70
-
Set it to point at a local Console instance during development:
71
-
72
-
```bash
73
-
export APIFY_CONSOLE_URL=http://localhost:3000
74
-
```
64
+
1. To reference the secret in`.actor/actor.json`, use the `@` prefix:
75
65
76
-
With a localhost Console, `apify login` also validates your token against the local API at `http://localhost:3333`.
0 commit comments