Skip to content

Latest commit

 

History

History
44 lines (36 loc) · 1.28 KB

3.7.x.md

File metadata and controls

44 lines (36 loc) · 1.28 KB

3.6.x to 3.7.x Upgrade Notes

If you're using MongoDB as configuration database run the following script against api_specs collection:

db.getCollection('api_specs').find({}).forEach(function(doc) {
    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);
    }
});

For the oauth_servers collection, run:

db.getCollection('oauth_servers').find({}).forEach(function(doc) {
    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);
    fn(doc.oauth_endpoints.revoke);
    fn(doc.oauth_endpoints.introspect);
    fn(doc.oauth_client_endpoints.create);
    fn(doc.oauth_client_endpoints.remove);
    
    db.oauth_servers.update({"_id": doc._id}, doc);
});