Update 3.6.x.md
@@ -4,13 +4,11 @@ If you're using `MongoDB` as configuration database run the following script aga
```javascript
db.getCollection('api_specs').find({}).forEach(function(doc) {
- if (!doc.proxy.upstreams || !doc.proxy.upstreams.targets) && !!doc.proxy.upstream_url {
- doc.plugins.push({
- "upstreams": {
+ if ((!doc.proxy.upstreams || !doc.proxy.upstreams.targets) && !!doc.proxy.upstream_url) {
+ doc.upstreams = {
"balancing": "roundrobin",
"targets": [{"target": doc.proxy.upstream_url}]
}
- });
delete doc.proxy.upstream_url;
db.api_specs.update({"_id": doc._id}, doc);
@@ -22,21 +20,17 @@ For the `oauth_servers` collection, run:
```javascript
db.getCollection('oauth_servers').find({}).forEach(function(doc) {
-
- fn = function(p) {
- if !!p && (!p.upstreams || !p.upstreams.targets) && !!p.upstream_url {
- p.push({
- "upstreams": {
+ var fn = function(p) {
+ if (!!p && (!p.upstreams || !p.upstreams.targets) && !!p.upstream_url) {
+ p.upstreams = {
"balancing": "roundrobin",
"targets": [{"target": p.upstream_url}]
}
- });
delete p.upstream_url;
}
}
-
fn(doc.oauth_endpoints.authorize);
fn(doc.oauth_endpoints.token);
fn(doc.oauth_endpoints.info);
