Environment

An environment is an object used to store data for an environment. APIs can consume environments as environment variables, command line arguments, or file configurations through the API Platform console. This helps to separate environment configuration, making your applications more portable.

Context

Environments are used to define API configuration data separately.

You are developing an API to run in the development environment and need to test it. In this context, you:

  • Write code to search for an environment variable called url-backend.

  • Define the sandbox environment variable as https://dev-my-internal-backend.company/v1.

  • Configure the production environment variable to point to a service that exposes the backend directly to the API Platform.

This allows you to fetch a container image running in the cloud and debug the same code locally if necessary.

Environment .yaml File Structure (apply command)

apiVersion: api-management.sensedia.com/v1
kind: Environment
spec:
  name: Development-CLI | environment name
  description: Development Environment v2 | environment description
  deploymentPermission:
    type: Organization | Me | Team
  tracePermission:
    type: Organization
  gatewayPoolRef:
    name: default
  inboundURL:
    inboundAddressRef:
      name: Production
    path: dev-2
  mapVars:
  - description: description | description da mapVar
    name: Map1 example | name of mapVar
    vars:
    - key: user-key | var key
      value: user-value | var destination
      variableType: DEFAULT | SECURED
      certificateRef: optional | certificate name

List environment

To list all available environments, use the command: ssd (api-management | apim) get environment.

Retrieve an environment

You can retrieve an environment by name, ID or content via YAML. Here are the commands to retrieve it:

  • By name: ssd (api-management | apim) get environment --name "Development-CLI"

  • By ID: ssd (api-management | apim) get environment --id 66

  • Via YAML: ssd (api-management|apim) get environment --id 66 -o yaml > environment.yaml

Be careful when applying an Environment, as it will replace the settings in the file. Also, if you use a value in an environment where there is active traffic, it may be impacted.
Thanks for your feedback!
EDIT

Share your suggestions with us!
Click here and then [+ Submit idea]