- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Kapeta exposes a number of environment variables to your applications which contains
everything from your block configuration to connection details for databases etc.
Note that most of these are already handled in the Kapeta SDK so if you're using that you wont need to worry too much about the details of these.
map them to the kapeta-specific ones.
The available kapeta-specific environment variables are:
Name | Description | Example value |
---|---|---|
KAPETA_SYSTEM_ID | The plan reference | kapeta://my-org/my-plan:1.2.3 |
KAPETA_BLOCK_REF | The block reference | kapeta://my-org/my-block:1.2.3 |
KAPETA_INSTANCE_ID | The instance id (UUID) of the block in the plan | 17c24593-d23e-4a0c-ae3f-88d918ebf3d1 |
KAPETA_CONSUMER_RESOURCE_<resource-name>_<port-type> | Resource information for the operator resource <resource-name> for <port-type> . Will contain credentials and connection details for resource | ResourceInfo (See below) |
KAPETA_CONSUMER_SERVICE_<resource-name>_<port-type> | Base URL for the service resource <resource-name> for <port-type> . Only meaningful for HTTP API resources | https://some-domain/api/ |
KAPETA_INSTANCE_OPERATOR_<instance-id> | Instance information for the operator instance with id <instance-id> | InstanceOperator (See below) |
KAPETA_INSTANCE_FOR_CONSUMER_<resource-name> | Block details for the block that provides the resource <resource-name> | BlockInstanceDetails[] (See below) |
KAPETA_INSTANCES_FOR_PROVIDER_<resource-name> | Block details for the blocks that consume the resource <resource-name> | BlockInstanceDetails (See below) |
KAPETA_INSTANCE_CONFIG | Configuration defined for your block | {"MyConfig":{"someKey":"someValue", ... }} |
KAPETA_BLOCK_HOSTS | Hosts for all the blocks in the current plan | {"some-instance-id":"localhost:40212", ... } |
KAPETA_PROVIDER_HOST | Host for the this block to bind to | 127.0.0.1 |
KAPETA_PROVIDER_PORT_<port-type> | Port for this block to bind to for <port-type> | 80 |
KAPETA_SYSTEM_TYPE* | The environment in which the block is started | kubernetes or local |
KAPETA_LOCAL_SERVER* | Sets the host to bind to. Is only used locally. | 127.0.0.1 |
KAPETA_LOCAL_SERVER_PORT_<port-type>* | Sets the port to bind to for <port-type> . Is only used locally. | 127.0.0.1 |
KAPETA_ENVIRONMENT_TYPE* | Added as HTTP Header X-Kapeta-Environment to all requests to the local cluster. Only used locally. | docker |
KAPETA_ENVIRONMENT_PLATFORM* | The platform that Kapeta is running on. Is only used locally. | win32 , darwin , linux |
Note: Variables marked with "*" is intended for internal use within Kapeta only.
ResourceInfo:
interface ResourceInfo {
host: string;
port: string | number;
type: string;
protocol: string;
options?: { [key:string]:any };
credentials?: { [key:string]:any };
}
InstanceOperator:
interface InstanceOperator {
hostname: string;
ports: {
[portType:string]: {
protocol: 'tcp'|'udp';
port: number;
}
};
path?: string;
query?: string;
hash?: string;
options?: { [key:string]:any };
credentials?: { [key:string]:any };
}
BlockInstanceDetails:
interface BlockInstanceDetails {
instanceId: string;
block: {
kind: string;
metadata: {
name: string;
description?: string;
title?: string;
visibility?: string;
};
spec: { [key:string]:any };
};
connections: {
consumer: {
blockId: string;
resourceName: string;
};
provider: {
blockId: string;
resourceName: string;
};
port?: {
type: string
};
mapping?: { [key: string]: any };
}[]
}
Was this article helpful?