Secret Collections

Secret Collections

Using secret collections to inject secrets during runs.

A secret collection defines one or more secrets used by your optimization model during execution. You can reference a secret collection either in an application instance configuration, or directly when starting a run. The platform then injects the secrets into the container during the optimization run as environment variables and files.

You can explore the API for secret collection operations using the API reference section of one of your applications.

Types of secrets

A secret collection can contain up to 20 secrets. The specification of the secret within your collection determines how the secret will be injected.

  • Type - Specifies file or env, which determines how to inject the secret into the runtime.
  • Location - Specifies where to put the secret.
    • For env type, its the name of the environment variable to use, such as ACME_LICENSE_KEY.
    • For file type, its the relative path to the execution directory for the file, for example licenses/acme.lic. Files are be stored relative to the execution home directory.
  • Value - The value of the secret. This value must be text, and is limited to 1 KB.

Using a secret collection

Secret collections are defined within the context of an application. You can associate a collection with one or more application instances, or specify the collection id as part of a run request.

The below example shows the payload for creating an application instance with a secrets collection.

{
  "id": "instance-1",
  "version_id": "version-1",
  "name": "delivery optimization",
  "description": "my delivery optimization run",
  "configuration": {
    "execution_class": "6c9500mb870s",
    "options": {},
    "secrets_collection_id": "opt-secrets"
  }
}
Copy

The following example shows specifying a secret collection as part of a run.

{
  "name": "optimization run",
  "input": {
    ...
  },
  "configuration": {
    "execution_class": "6c9500mb870s",
    "secrets_collection_id": "opt-secrets"
  },
}
Copy

Limits

  • 20 secrets per collection
  • 1 KB maximum per secret in collection
  • Text only content
  • Files must be located relative to the optimization model home directory. You cannot store a secret above the home directory (ie /mydir/myfile will be located at ./mydir/myfile from the perspective of your optimization code)

Page last updated

Go to on-page nav menu