mirror of
https://github.com/docker/compose.git
synced 2026-10-08 21:21:10 +00:00
Change the way a context is stored
Initially we stored the context data in the `Metadata` of the context
but in hindsight this data would be better of in the `Endpoints` because
that's what it is used for.
Before:
```json
{
"Name": "aci",
"Metadata": {
"Type": "aci",
"Data": {
"key": "value"
}
},
"Endpoints": {
"docker": {}
}
}
```
After:
```json
{
"Name": "aci",
"Type": "aci",
"Metadata": {},
"Endpoints": {
"aci": {
"key": "value"
},
"docker": {}
}
}
```
With this change the contexts that we create are more in line with the contexts the docker cli creates.
It also makes the code less complicated since we don't need to marsal twice any more. The API is nicer too:
```go
// Get a context:
c, err := store.Get(contextName)
// Get the stored endpoint:
var aciContext store.AciContext
if err := contextStore.GetEndpoint(currentContext, &aciContext); err != nil {
return nil, err
}
```
This commit is contained in:
parent
de33f183df
commit
11339761ca
15 changed files with 199 additions and 159 deletions
|
|
@ -35,9 +35,7 @@ func (sut *CliSuite) BeforeTest(suiteName, testName string) {
|
|||
)
|
||||
require.Nil(sut.T(), err)
|
||||
|
||||
err = s.Create("example", store.TypedContext{
|
||||
Type: "example",
|
||||
})
|
||||
err = s.Create("example", "example", "", store.ContextMetadata{})
|
||||
require.Nil(sut.T(), err)
|
||||
|
||||
sut.storeRoot = dir
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue