Context files are used to define deployment enviroments. Multiple contexts representing different enviroments can be created with each context specifying an appropriate provider and a set of properties required/understood by that provider with the ability to switch between them. Contexts are persisted in individual files under the
.fn directory which, if not present, is created on launch.
~ .fn config.yaml contexts default.yaml
config.yaml contains the name of currently selected context, when first created the current context is not set:
default.yaml default values are set:
api-url: http://localhost:8080 provider: default registry: ""
- api-url - the fn-server endpoint.
- provider - the a specific provider which identifies a set of properties required/understood by that provider.
- registry - the Docker registry username to push images to
The list all context use
$ fn list context
Creating a Context
To create a context use
create. The context file will be created with default values but option flags can be used override.
$ fn create context <context> $ fn create context <context> --api-url foo --provider bar --registry <dockerhub-username>
Using a Context
To use a context use
use followed by the name of the context.
$ fn use context <context>
Deleting a Context
To delete a context use
delete followed by the name of the context.
You can not delete the currently used context or the default context as it is protected.
$ fn delete context <context>
To unset the current context use
This will unset the current-context.
$ fn unset context
To update the current context use
update followed by a key value pair:
$ fn update context <key> <value>
The current supported env vars 'FN_API_URL' and 'FN_REGISTRY' will override the configured context properties.