github.com/hellofresh/janus@v0.0.0-20230925145208-ce8de8183c67/docs/upgrade/3.7.x.md (about)

     1  # 3.6.x to 3.7.x Upgrade Notes
     2  
     3  If you're using `MongoDB` as configuration database run the following script against `api_specs` collection:
     4  
     5  ```javascript
     6  db.getCollection('api_specs').find({}).forEach(function(doc) {
     7      if ((!doc.proxy.upstreams || !doc.proxy.upstreams.targets) && !!doc.proxy.upstream_url) {
     8          doc.upstreams = {
     9              "balancing": "roundrobin",
    10              "targets": [{"target": doc.proxy.upstream_url}]
    11         }
    12          
    13          delete doc.proxy.upstream_url;
    14          db.api_specs.update({"_id": doc._id}, doc);
    15      }
    16  });
    17  ```
    18  
    19  For the `oauth_servers` collection, run:
    20  
    21  ```javascript
    22  db.getCollection('oauth_servers').find({}).forEach(function(doc) {
    23      var fn = function(p) {
    24        if (!!p && (!p.upstreams || !p.upstreams.targets) && !!p.upstream_url) {
    25            p.upstreams = {
    26                "balancing": "roundrobin",
    27                "targets": [{"target": p.upstream_url}]
    28            }
    29  
    30            delete p.upstream_url;
    31        }
    32      }
    33      
    34      fn(doc.oauth_endpoints.authorize);
    35      fn(doc.oauth_endpoints.token);
    36      fn(doc.oauth_endpoints.info);
    37      fn(doc.oauth_endpoints.revoke);
    38      fn(doc.oauth_endpoints.introspect);
    39      fn(doc.oauth_client_endpoints.create);
    40      fn(doc.oauth_client_endpoints.remove);
    41      
    42      db.oauth_servers.update({"_id": doc._id}, doc);
    43  });
    44  ```