# Print env vars (`lukaskrivka/print-env-vars`) Actor

Prints both raw and parsed environment variables provided to each actor run. Stores them to dataset, KV Store and log for easy analysis.

- **URL**: https://apify.com/lukaskrivka/print-env-vars.md
- **Developed by:** [Lukáš Křivka](https://apify.com/lukaskrivka) (community)
- **Categories:** Developer tools, Open source
- **Stats:** 8 total users, 0 monthly users, 100.0% runs succeeded, 3 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

### Example output
These are env vars at the time of writing this actor. For latest state, just run it.

#### RAW ENV VARS
Available with `process.env`

```js
{
  APIFY_PROXY_PASSWORD: '*********',
  APIFY_PROXY_STATUS_URL: 'http://proxy.apify.com',
  APIFY_USER_ID: 'mPSyG35Lffj5ybtgz',
  npm_config_user_agent: 'npm/10.2.4 node/v18.19.1 linux x64 workspaces/false',
  APIFY_IS_AT_HOME: '1',
  APIFY_ACT_RUN_ID: 'isBHoiJgoZxdFGedb',
  NODE_VERSION: '18.19.1',
  HOSTNAME: '6eef2bdf7271',
  ACTOR_DEFAULT_REQUEST_QUEUE_ID: 'QRYxQqh9XlvRmGdva',
  ACTOR_RUN_ID: 'isBHoiJgoZxdFGedb',
  APIFY_FACT: 'There are no weapons of mass destruction in Iraq, Chuck Norris lives in Oklahoma.',
  APIFY_DEFAULT_REQUEST_QUEUE_ID: 'QRYxQqh9XlvRmGdva',
  YARN_VERSION: '1.22.19',
  npm_node_execpath: '/usr/local/bin/node',
  SHLVL: '3',
  npm_config_noproxy: '',
  ACTOR_TIMEOUT_AT: '2024-04-04T14:49:28.483Z',
  APIFY_TIMEOUT_AT: '2024-04-04T14:49:28.483Z',
  HOME: '/root',
  npm_package_json: '/usr/src/app/package.json',
  ACTOR_STANDBY_PORT: '4322',
  APIFY_ACTOR_RUN_ID: 'isBHoiJgoZxdFGedb',
  npm_package_engines_node: '>=18.0.0',
  NODE_OPTIONS: '--max_old_space_size=30000 --max-http-header-size=80000',
  ACTOR_BUILD_ID: '1dwKs4eE5zBfM9s9C',
  APIFY_PROXY_PORT: '8011',
  npm_config_userconfig: '/root/.npmrc',
  npm_config_local_prefix: '/usr/src/app',
  ACTOR_DEFAULT_KEY_VALUE_STORE_ID: 'Gpo6nIdDdn3jit89X',
  ACTOR_EVENTS_WEBSOCKET_URL: 'ws://10.0.83.204:9092/isBHoiJgoZxdFGedb',
  APIFY_DEFAULT_KEY_VALUE_STORE_ID: 'Gpo6nIdDdn3jit89X',
  COLOR: '1',
  ACTOR_MEMORY_MBYTES: '256',
  APIFY_MEMORY_MBYTES: '256',
  npm_config_progress: '',
  ACTOR_BUILD_NUMBER: '0.0.6',
  APIFY_SDK_LATEST_VERSION: '2.2.2',
  APIFY_ACTOR_BUILD_ID: '1dwKs4eE5zBfM9s9C',
  APIFY_ACTOR_EVENTS_WS_URL: 'ws://10.0.83.204:9092/isBHoiJgoZxdFGedb',
  APIFY_ACT_ID: 'oXTuyqGR803PjzDha',
  ACTOR_ID: 'oXTuyqGR803PjzDha',
  npm_config_prefix: '/usr/local',
  npm_config_npm_version: '10.2.4',
  ACTOR_INPUT_KEY: 'INPUT',
  APIFY_INPUT_KEY: 'INPUT',
  TERM: 'xterm',
  APIFY_DEDICATED_CPUS: '0.0546875',
  APIFY_META_ORIGIN: 'DEVELOPMENT',
  APIFY_WORKFLOW_KEY: 'gqaov514eih1',
  APIFY_ACTOR_BUILD_NUMBER: '0.0.6',
  npm_config_cache: '/root/.npm',
  ACTOR_MAX_PAID_DATASET_ITEMS: '',
  APIFY_PROXY_HOSTNAME: '10.0.83.204',
  APIFY_ACTOR_ID: 'oXTuyqGR803PjzDha',
  npm_config_node_gyp: '/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
  PATH: '/usr/src/app/node_modules/.bin:/usr/src/node_modules/.bin:/usr/node_modules/.bin:/node_modules/.bin:/usr/local/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
  NODE: '/usr/local/bin/node',
  npm_package_name: 'js-scrape-single-page',
  APIFY_DISABLE_OUTDATED_WARNING: '',
  APIFY_API_PUBLIC_BASE_URL: 'https://api.apify.com',
  ACTOR_WEB_SERVER_URL: 'https://sdmufc32a7tc.runs.apify.net',
  APIFY_TOKEN: '*********',
  npm_config_loglevel: 'silent',
  npm_lifecycle_script: 'node ./src/main.js',
  ACTOR_TASK_ID: '',
  npm_package_version: '0.0.1',
  npm_lifecycle_event: 'start',
  APIFY_API_BASE_URL: 'http://10.0.83.204:8010/',
  npm_config_update_notifier: '',
  ACTOR_STARTED_AT: '2024-04-04T14:43:28.483Z',
  ACTOR_WEB_SERVER_PORT: '4321',
  APIFY_CONTAINER_URL: 'https://sdmufc32a7tc.runs.apify.net',
  APIFY_STARTED_AT: '2024-04-04T14:43:28.483Z',
  APIFY_HEADLESS: '1',
  ACTOR_DEFAULT_DATASET_ID: 'a5ghrBUX09exB6grE',
  APIFY_ACTOR_TASK_ID: '',
  APIFY_DEFAULT_DATASET_ID: 'a5ghrBUX09exB6grE',
  npm_config_globalconfig: '/usr/local/etc/npmrc',
  npm_config_init_module: '/root/.npm-init.js',
  APIFY_CONTAINER_PORT: '4321',
  PWD: '/usr/src/app',
  npm_execpath: '/usr/local/lib/node_modules/npm/bin/npm-cli.js',
  npm_config_global_prefix: '/usr/local',
  npm_command: 'start',
  NODE_ENV: 'production',
  INIT_CWD: '/usr/src/app',
  EDITOR: 'vi'
}
````

#### PARSED ENV VARS

Available with `Actor.getEnv()`

```js
{
  apiBaseUrl: 'http://10.0.83.204:8010/',
  apiPublicBaseUrl: 'https://api.apify.com',
  chromeExecutablePath: null,
  dedicatedCpus: 0,
  disableOutdatedWarning: null,
  fact: 'There are no weapons of mass destruction in Iraq, Chuck Norris lives in Oklahoma.',
  headless: '1',
  inputSecretsPrivateKeyFile: null,
  inputSecretsPrivateKeyPassphrase: null,
  isAtHome: '1',
  localStorageDir: null,
  logLevel: null,
  logFormat: null,
  metaOrigin: 'DEVELOPMENT',
  metamorphAfterSleepMillis: null,
  persistStateIntervalMillis: null,
  proxyPassword: '*********',
  proxyHostname: '10.0.83.204',
  proxyPort: 8011,
  proxyStatusUrl: 'http://proxy.apify.com',
  purgeOnStart: null,
  sdkLatestVersion: '2.2.2',
  systemInfoIntervalMillis: null,
  token: '*********',
  userId: 'mPSyG35Lffj5ybtgz',
  workflowKey: 'gqaov514eih1',
  xvfb: null,
  actorBuildId: '1dwKs4eE5zBfM9s9C',
  actorBuildNumber: '0.0.6',
  actorEventsWsUrl: 'ws://10.0.83.204:9092/isBHoiJgoZxdFGedb',
  actorId: 'oXTuyqGR803PjzDha',
  actorMaxPaidDatasetItems: null,
  actorRunId: 'isBHoiJgoZxdFGedb',
  actorTaskId: null,
  containerPort: 4321,
  containerUrl: 'https://sdmufc32a7tc.runs.apify.net',
  defaultDatasetId: 'a5ghrBUX09exB6grE',
  defaultKeyValueStoreId: 'Gpo6nIdDdn3jit89X',
  defaultRequestQueueId: 'QRYxQqh9XlvRmGdva',
  inputKey: 'INPUT',
  memoryMbytes: 256,
  startedAt: 2024-04-04T14:43:28.483Z,
  timeoutAt: 2024-04-04T14:49:28.483Z,
  actId: 'oXTuyqGR803PjzDha',
  actRunId: 'isBHoiJgoZxdFGedb',
  buildId: '1dwKs4eE5zBfM9s9C',
  buildNumber: '0.0.6',
  eventsWebsocketUrl: 'ws://10.0.83.204:9092/isBHoiJgoZxdFGedb',
  maxPaidDatasetItems: null,
  webServerPort: 4321,
  webServerUrl: 'https://sdmufc32a7tc.runs.apify.net'
}
```

## Actor input object example

```json
{}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("lukaskrivka/print-env-vars").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("lukaskrivka/print-env-vars").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call lukaskrivka/print-env-vars --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=lukaskrivka/print-env-vars",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Print env vars",
        "description": "Prints both raw and parsed environment variables provided to each actor run. Stores them to dataset, KV Store and log for easy analysis.",
        "version": "0.0",
        "x-build-id": "6PE6ayqvaieDGyYPf"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/lukaskrivka~print-env-vars/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-lukaskrivka-print-env-vars",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/lukaskrivka~print-env-vars/runs": {
            "post": {
                "operationId": "runs-sync-lukaskrivka-print-env-vars",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/lukaskrivka~print-env-vars/run-sync": {
            "post": {
                "operationId": "run-sync-lukaskrivka-print-env-vars",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {}
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
