mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fix: using bolt config/header update now overwrites (#456)
This commit is contained in:
@@ -143,12 +143,7 @@ func (ds *BoltDatastore) UpdateApp(ctx context.Context, newapp *models.App) (*mo
|
|||||||
|
|
||||||
// Update app fields
|
// Update app fields
|
||||||
if newapp.Config != nil {
|
if newapp.Config != nil {
|
||||||
if app.Config == nil {
|
app.Config = newapp.Config
|
||||||
app.Config = map[string]string{}
|
|
||||||
}
|
|
||||||
for k, v := range newapp.Config {
|
|
||||||
app.Config[k] = v
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buf, err := json.Marshal(app)
|
buf, err := json.Marshal(app)
|
||||||
@@ -352,20 +347,10 @@ func (ds *BoltDatastore) UpdateRoute(ctx context.Context, newroute *models.Route
|
|||||||
route.MaxConcurrency = newroute.MaxConcurrency
|
route.MaxConcurrency = newroute.MaxConcurrency
|
||||||
}
|
}
|
||||||
if newroute.Headers != nil {
|
if newroute.Headers != nil {
|
||||||
if route.Headers == nil {
|
route.Headers = newroute.Headers
|
||||||
route.Headers = map[string][]string{}
|
|
||||||
}
|
|
||||||
for k, v := range newroute.Headers {
|
|
||||||
route.Headers[k] = v
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if newroute.Config != nil {
|
if newroute.Config != nil {
|
||||||
if route.Config == nil {
|
route.Config = newroute.Config
|
||||||
route.Config = map[string]string{}
|
|
||||||
}
|
|
||||||
for k, v := range newroute.Config {
|
|
||||||
route.Config[k] = v
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := route.Validate(); err != nil {
|
if err := route.Validate(); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user