jasonmimick / atlas-osb

DEPRECATED: See https://github.com/mongodb/atlas-osb

Home Page:https://github.com/mongodb/atlas-osb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inconsistent connection parameters in credentials settings for smooth migration

leo-ri opened this issue · comments

An old project could have difficulties with the connection if they move from mongodb-odb to atlas broker

With the old broker app uses environment variables (VCAP_SERVICES):
{
"mongodb-odb": [{
"label": "mongodb-odb",
"provider": null,
"plan": "standalone_small",
"name": "test4",
"tags": ["mongodb"],
"instance_name": "test4",
"binding_name": null,
"credentials": {
"database": "default",
"password": "password",
"servers": ["10.0.9.9:28000"],
"ssl": false,
"uri": "mongodb://username:password@10.0.9.9:28000/default?authSource=admin",
"username": "username"
},
"syslog_drain_url": null,
"volume_mounts": []
}]
}
And the users have the possibility to use either uri or set parameters using servers/users/pass/etc for connection

If we install app with Atlas, we will have something like:
{
"mongodb-atlas-aws": [{
"label": "mongodb-atlas-aws",
"provider": null,
"plan": "M10",
"name": "aws-test",
"tags": [],
"instance_name": "aws-test",
"binding_name": null,
"credentials": {
"username": "username",
"password": "password",
"uri": "mongodb+srv://ca6aaf79-5741-4ba0.xqzpq.mongodb.net"
},
"syslog_drain_url": null,
"volume_mounts": []
}]
}
As we can see, the users would have to rewrite their apps for making them work again:
if uri was used for connection then we do not have user/pass/defaultdbname ( connection documentation
mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
Also, we could use format (ruby, probably some other languges/libraries)
client = Mongo::Client.new(
credentials["servers"],
:database => credentials["database"],
:user => credentials["username"],
:password => credentials["password"],
:auth_source => "admin"
)

In the end, I believe our credentials should be similar, otherwise, this will lead to fixing and pushing apps again. (let's not forget about if someone already uses atlas broker)

Working for Alpha release Fix: #4