github.com/fnproject/cli@v0.0.0-20240508150455-e5d88bd86117/CONTEXT.md (about) 1 # Context command 2 3 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. 4 5 ``` 6 ~ 7 .fn 8 config.yaml 9 contexts 10 default.yaml 11 ``` 12 13 The `config.yaml` contains the name of currently selected context, when first created the current context is not set: 14 15 ``` 16 current-context: "" 17 ``` 18 19 Within the `default.yaml` default values are set: 20 ``` 21 api-url: http://localhost:8080 22 provider: default 23 registry: "" 24 ``` 25 26 * api-url - the fn-server endpoint. 27 * provider - the a specific provider which identifies a set of properties required/understood by that provider. 28 * registry - the Docker registry username to push images to 29 [registry.hub.docker.com/`registry`]. 30 31 ### Listing Contexts 32 33 The list all context use `ls` or `list`. 34 ``` 35 $ fn list context 36 ``` 37 38 ### Creating a Context 39 40 To create a context use `c` or `create`. The context file will be created with default values but option flags can be used override. 41 42 ``` 43 $ fn create context <context> 44 $ fn create context <context> --api-url foo --provider bar --registry <dockerhub-username> 45 ``` 46 47 ### Using a Context 48 49 To use a context use `u` or `use` followed by the name of the context. 50 51 ``` 52 $ fn use context <context> 53 ``` 54 55 ### Deleting a Context 56 57 To delete a context use `d` or `delete` followed by the name of the context. 58 59 _You can not delete the currently used context or the default context as it is protected._ 60 61 ``` 62 $ fn delete context <context> 63 ``` 64 65 ### Unsetting Context 66 67 To unset the current context use `un` or `unset`: 68 69 _This will unset the current-context._ 70 71 ``` 72 $ fn unset context 73 ``` 74 75 ### Updating Context 76 77 To update the current context use `up` or `update` followed by a key value pair: 78 79 ``` 80 $ fn update context <key> <value> 81 ``` 82 83 # Enviroment Variables 84 85 _The current supported env vars 'FN_API_URL' and 'FN_REGISTRY' will override the configured context properties_.