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
orenv
, 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 asACME_LICENSE_KEY
. - For
file
type, its the relative path to the execution directory for the file, for examplelicenses/acme.lic
. Files are be stored relative to the execution home directory.
- For
- 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.
The following example shows specifying a secret collection as part of a run.
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)